站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

Lookup.Template (Utilities API) - NetBeans API Javadoc (Current Development Version)

org.openide.util 7.9.0 1

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 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(Class<T> type)
          Create a simple template matching by class.
Lookup.Template(Class<T> type, String id, T instance)
          Constructor to create new template.
 
Method Summary
 boolean equals(Object obj)
           
 String getId()
          Get the persistent identifier being searched for, if any.
 T getInstance()
          Get the specific instance being searched for, if any.
 Class<T> getType()
          Get the class (or superclass or interface) to search for.
 int hashCode()
           
 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(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(Class<T> type,
                       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 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 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 Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

org.openide.util 7.9.0 1

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.