Packagecom.yworks.support
Classpublic class Lookups
InheritanceLookups Inheritance Object

Static utility class that servers as a factory for various ILookup implementations.



Public Properties
 PropertyDefined By
  EMPTY : ILookup
[static] An ILookup instance that always returns null.
Lookups
  EMPTY_CONTEXT : IContextLookup
[static] An IContextLookup instance that always returns null.
Lookups
Public Methods
 MethodDefined By
  
addingLookupChainLink(type:Class, instance:Object):IContextLookupChainLink
[static] Factory method for a lookup chain element that simply adds an entry to a lookup chain.
Lookups
  
[static] Creates a lookup chain link that is backed by the given callback.
Lookups
  
[static] Factory method for a lookup chain element that adds an dynamic instance to a lookup chain.
Lookups
Property Detail
EMPTYproperty
public static var EMPTY:ILookup

An ILookup instance that always returns null.

EMPTY_CONTEXTproperty 
public static var EMPTY_CONTEXT:IContextLookup

An IContextLookup instance that always returns null.

Method Detail
addingLookupChainLink()method
public static function addingLookupChainLink(type:Class, instance:Object):IContextLookupChainLink

Factory method for a lookup chain element that simply adds an entry to a lookup chain.

Parameters

type:Class — The type to add to the lookup.
 
instance:Object — The instance to return if the type is being looked up.

Returns
IContextLookupChainLink — An instance that can be used in a lookup chain.
createContextLookupChainLink()method 
public static function createContextLookupChainLink(callback:Function):IContextLookupChainLink

Creates a lookup chain link that is backed by the given callback.

This can be used to query the results of a virtual lookup call on objects that don't necessarily implement Ilookup.

If the callback returns null the request is passed to the chain.

The callback function has to accept two arguments:

		 function lookupCallback( subject:Object, type:Class ):Object
		 
Where the subject parameter represents the subject for which a lookup should be made and the type parameter represents the type for which an implementation is being looked up.

Parameters

callback:Function — The callback function to invoke.

Returns
IContextLookupChainLink — The implementation of the chain link that uses the callback.
dynamicAddingLookupChainLink()method 
public static function dynamicAddingLookupChainLink(instance:Object):IContextLookupChainLink

Factory method for a lookup chain element that adds an dynamic instance to a lookup chain.

The instance returned will check whether instance is of the queried type and will then return the instance.

Parameters

instance:Object — The instance to query the type from dynamically.

Returns
IContextLookupChainLink — An instance that can be used in a lookup chain.