org.openide.util.lookup
Interface InstanceContent.Convertor<T,R>

Enclosing class:
InstanceContent

public static interface InstanceContent.Convertor<T,R>

Convertor postpones an instantiation of an object.

Since:
1.25

Method Summary
 R convert(T obj)
          Convert obj to other object.
 java.lang.String displayName(T obj)
          The human presentable name for the object.
 java.lang.String id(T obj)
          Computes the ID of the resulted object.
 java.lang.Class<? extends R> type(T obj)
          Return type of converted object.
 

Method Detail

convert

R convert(T obj)
Convert obj to other object. There is no need to implement cache mechanism. It is provided by Lookup.Item.getInstance() method itself. However the method can be called more than once because instance is held just by weak reference.

Parameters:
obj - the registered object
Returns:
the object converted from this object

type

java.lang.Class<? extends R> type(T obj)
Return type of converted object. Accessible via Lookup.Item.getType()

Parameters:
obj - the registered object
Returns:
the class that will be produced from this object (class or superclass of convert (obj))

id

java.lang.String id(T obj)
Computes the ID of the resulted object. Accessible via Lookup.Item.getId().

Parameters:
obj - the registered object
Returns:
the ID for the object

displayName

java.lang.String displayName(T obj)
The human presentable name for the object. Accessible via Lookup.Item.getDisplayName().

Parameters:
obj - the registered object
Returns:
the name representing the object for the user