org.openide.util.lookup
Class SimpleProxyLookup

java.lang.Object
  extended by org.openide.util.Lookup
      extended by org.openide.util.lookup.SimpleProxyLookup

final class SimpleProxyLookup
extends Lookup

Simple proxy lookup. Keeps reference to a lookup it delegates to and forwards all requests.

Author:
Jaroslav Tulach

Nested Class Summary
 
Nested classes/interfaces inherited from class org.openide.util.Lookup
Lookup.Item<T>, Lookup.Provider, Lookup.Result<T>, Lookup.Template<T>
 
Field Summary
 
Fields inherited from class org.openide.util.Lookup
EMPTY
 
Constructor Summary
SimpleProxyLookup(Lookup.Provider provider)
           
 
Method Summary
<T> T
lookup(java.lang.Class<T> clazz)
          Look up an object matching a given interface.
<T> Lookup.Result<T>
lookup(Lookup.Template<T> template)
          The general lookup method.
<T> Lookup.Item<T>
lookupItem(Lookup.Template<T> template)
          Look up the first item matching a given template.
 
Methods inherited from class org.openide.util.Lookup
getDefault, lookupAll, lookupResult
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleProxyLookup

SimpleProxyLookup(Lookup.Provider provider)
Parameters:
provider - provider to delegate to
Method Detail

lookup

public <T> Lookup.Result<T> lookup(Lookup.Template<T> template)
Description copied from class: Lookup
The general lookup method. Callers can get list of all instances and classes that match the given template, request more info about them in form of Lookup.Item and attach a listener to this be notified about changes. The general interface does not specify whether subsequent calls with the same template produce new instance of the Lookup.Result or return shared instance. The prefered behaviour however is to return shared one.

Specified by:
lookup in class Lookup
Parameters:
template - a template describing the services to look for
Returns:
an object containing the results

lookup

public <T> T lookup(java.lang.Class<T> clazz)
Description copied from class: Lookup
Look up an object matching a given interface. This is the simplest method to use. If more than one object matches, the first will be returned. The template class may be a class or interface; the instance is guaranteed to be assignable to it.

Specified by:
lookup in class Lookup
Parameters:
clazz - class of the object we are searching for
Returns:
an object implementing the given class or null if no such implementation is found

lookupItem

public <T> Lookup.Item<T> lookupItem(Lookup.Template<T> template)
Description copied from class: Lookup
Look up the first item matching a given template. Includes not only the instance but other associated information.

Overrides:
lookupItem in class Lookup
Parameters:
template - the template to check
Returns:
a matching item or null