The basic lookup interface that allows for retrieving implementations for different aspects of the current instance.
Inheritance Hierarchy
Remarks
The lookup idiom allows for dynamically providing, adding, changing, and removing implementation aspects of an instance that would not be possible to achieve using ordinary object oriented methods.
Type Details
- yfiles module
- view-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.graph.ILookup
See Also
Methods
Returns an instance that implements the given type or null
.
Remarks
Typically, this method will be called in order to obtain a different view or aspect of the current instance. This is quite similar to casting or using a super type or interface of this instance, but is not limited to inheritance or compile time constraints. An instance implementing this method is not required to return non-
null
implementations for the types, nor does it have to return the same instance any time. Also it depends on the type and context whether the instance returned stays up to date or needs to be reobtained for subsequent use.Type Parameters
- T: any
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- type - Class<T>
- The type for which an instance shall be returned.
Returns
- ↪T
- an instance that is assignable to type or
null
See Also
Note that the
$class
property on JavaScript classes inheriting from yFiles classes is only valid once an instance of this subclass was created. Call fixType, first or instantiate the class at least once.Constants
An ILookup
instance that always returns null
.
Static Methods
Creates an ILookup implementation that wraps an existing ILookup instance using an additional lookup implementations.
Remarks
For each lookup call that the
additionalLookup
yields null
, the basicLookup
will be queried instead.Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- basicLookup - ILookup
- the fallback lookup implementation
- additionalLookup - ILookup
- the lookup that has precedence over the fallback
Returns
- ↪ILookup
- an implementation that decorates the first with the latter
Creates a dynamic ILookup implementation that for each type that the given subject can be assigned to yields that subject.
Creates a mutable ILookup implementation that is backed by an IMap<TKey,TValue>.
Remarks
The lookup method uses the specified type as key when delegating to the
backingDictionary
.Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- backingDictionary - HashMap<Class,Object>
- The backing HashMap<TKey,TValue> that is used in the lookup calls.