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

java.lang.Object
  extended by org.openide.util.Lookup.Template<T>
Enclosing class:
Lookup

public static final class Lookup.Template<T>
extends java.lang.Object

Template defining a pattern to filter instances by.


Constructor Summary
Lookup.Template()
          Deprecated. Use new Template (Object.class) which is going to be better typed with JDK1.5 templates and should produce the same result.
Lookup.Template(java.lang.Class<T> type)
          Create a simple template matching by class.
Lookup.Template(java.lang.Class<T> type, java.lang.String id, T instance)
          Constructor to create new template.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getId()
          Get the persistent identifier being searched for, if any.
 T getInstance()
          Get the specific instance being searched for, if any.
 java.lang.Class<T> getType()
          Get the class (or superclass or interface) to search for.
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Lookup.Template

@Deprecated
public Lookup.Template()
Deprecated. Use new Template (Object.class) which is going to be better typed with JDK1.5 templates and should produce the same result.

General template to find all possible instances.


Lookup.Template

public Lookup.Template(java.lang.Class<T> type)
Create a simple template matching by class.

Parameters:
type - the class of service we are looking for (subclasses will match)

Lookup.Template

public Lookup.Template(java.lang.Class<T> type,
                       java.lang.String id,
                       T instance)
Constructor to create new template.

Parameters:
type - the class of service we are looking for or null to leave unspecified
id - the ID of the item/service we are looking for or null to leave unspecified
instance - a specific known instance to look for or null to leave unspecified
Method Detail

getType

public java.lang.Class<T> getType()
Get the class (or superclass or interface) to search for. If it was not specified in the constructor, Object is used as this will match any instance.

Returns:
the class to search for

getId

public java.lang.String getId()
Get the persistent identifier being searched for, if any.

Returns:
the ID or null
Since:
1.8
See Also:
Lookup.Item.getId()

getInstance

public T getInstance()
Get the specific instance being searched for, if any. Most useful for finding an Item when the instance is already known.

Returns:
the object to find or null
Since:
1.8

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

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