org.openide.util
Class Lookup.Item<T>

java.lang.Object
  extended by org.openide.util.Lookup.Item<T>
Direct Known Subclasses:
AbstractLookup.Pair
Enclosing class:
Lookup

public abstract static class Lookup.Item<T>
extends java.lang.Object

A single item in a lookup result. This wrapper provides unified access to not just the instance, but its class, a possible persistent identifier, and so on.

Since:
1.25

Constructor Summary
Lookup.Item()
           
 
Method Summary
abstract  java.lang.String getDisplayName()
          Get a human presentable name for the item.
abstract  java.lang.String getId()
          Get a persistent indentifier for the item.
abstract  T getInstance()
          Get the instance itself.
abstract  java.lang.Class<? extends T> getType()
          Get the implementing class of the instance.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Lookup.Item

public Lookup.Item()
Method Detail

getInstance

public abstract T getInstance()
Get the instance itself.

Returns:
the instance or null if the instance cannot be created

getType

public abstract java.lang.Class<? extends T> getType()
Get the implementing class of the instance.

Returns:
the class of the item

getId

public abstract java.lang.String getId()
Get a persistent indentifier for the item. This identifier should uniquely represent the item within its containing lookup (and if possible within the global lookup as a whole). For example, it might represent the source of the instance as a file name. The ID may be persisted and in a later session used to find the same instance as was encountered earlier, by means of passing it into a lookup template.

Returns:
a string ID of the item

getDisplayName

public abstract java.lang.String getDisplayName()
Get a human presentable name for the item. This might be used when summarizing all the items found in a lookup result in some part of a GUI.

Returns:
the string suitable for presenting the object to a user

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object