Search this API

y.io.graphml
Class DictionaryLookup

java.lang.Object
  extended by y.io.graphml.DictionaryLookup
All Implemented Interfaces:
Lookup

public final class DictionaryLookup
extends java.lang.Object
implements Lookup

A simple mutable Lookup implementation that is backed by a Map.

 

Constructor Summary
DictionaryLookup()
          Creates an instance with an initially empty map as backing store.
DictionaryLookup(java.util.Map map)
          Creates an instance with the given map as the backing store.
 
Method Summary
 boolean hasLookup(java.lang.Class type)
          Determines whether the specified type exists in this lookup.
 java.lang.Object lookup(java.lang.Class type)
          Performs the lookup
 void put(java.lang.Class type, java.lang.Object value)
          Adds an in instance to the map for the given type.
 void remove(java.lang.Class type)
          Removes the specified type from this lookup.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DictionaryLookup

public DictionaryLookup()
Creates an instance with an initially empty map as backing store.


DictionaryLookup

public DictionaryLookup(java.util.Map map)
Creates an instance with the given map as the backing store.

Parameters:
map - the backing store.
Throws:
java.lang.IllegalArgumentException - if the map is null
Method Detail

put

public void put(java.lang.Class type,
                java.lang.Object value)
Adds an in instance to the map for the given type.

If value is null the entry is removed from the map.

Parameters:
type - the type that will be used as a key for queries
value - the instance implementing type or null
Throws:
java.lang.IllegalArgumentException - if the parameters do not match

lookup

public java.lang.Object lookup(java.lang.Class type)
Performs the lookup

Specified by:
lookup in interface Lookup
Parameters:
type - the type to query
Returns:
the instance found in the map or null

hasLookup

public boolean hasLookup(java.lang.Class type)
Determines whether the specified type exists in this lookup.

Parameters:
type - The type to look up.
Returns:
true if the specified type exists in this lookup; false otherwise.

remove

public void remove(java.lang.Class type)
Removes the specified type from this lookup.

Parameters:
type - The type to remove from this instance.

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.