org.openide.util 6.8.22

org.openide.util.lookup
Class ProxyLookup

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

public class ProxyLookup
extends Lookup

Implementation of lookup that can delegate to others.

Since:
1.9

Nested Class Summary
 
Nested classes/interfaces inherited from class org.openide.util.Lookup
Lookup.Item, Lookup.Provider, Lookup.Result, Lookup.Template
 
Field Summary
 
Fields inherited from class org.openide.util.Lookup
EMPTY
 
Constructor Summary
protected ProxyLookup()
          Create a lookup initially proxying to no others.
  ProxyLookup(Lookup[] lookups)
          Create a proxy to some other lookups.
 
Method Summary
protected  void beforeLookup(Lookup.Template template)
          Notifies subclasses that a query is about to be processed.
protected  Lookup[] getLookups()
          Getter for the delegates.
 Object lookup(Class clazz)
          Look up an object matching a given interface.
 Lookup.Result lookup(Lookup.Template template)
          The general lookup method.
 Lookup.Item lookupItem(Lookup.Template template)
          Look up the first item matching a given template.
protected  void setLookups(Lookup[] lookups)
          Change the delegates.
 String toString()
           
 
Methods inherited from class org.openide.util.Lookup
getDefault
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProxyLookup

public ProxyLookup(Lookup[] lookups)
Create a proxy to some other lookups.

Parameters:
lookups - the initial delegates

ProxyLookup

protected ProxyLookup()
Create a lookup initially proxying to no others. Permits serializable subclasses.

Since:
3.27
Method Detail

toString

public String toString()
Overrides:
toString in class Object

getLookups

protected final Lookup[] getLookups()
Getter for the delegates.

Returns:
the array of lookups we delegate to
Since:
1.19

setLookups

protected final void setLookups(Lookup[] lookups)
Change the delegates. To forbid anybody else then the creator of the lookup to change the delegates, this method is protected.

Parameters:
lookups - the new lookups to delegate to
Since:
1.19 protected

beforeLookup

protected void beforeLookup(Lookup.Template template)
Notifies subclasses that a query is about to be processed. Subclasses can update its state before the actual processing begins. It is allowed to call setLookups method to change/update the set of objects the proxy delegates to.

Parameters:
template - the template of the query
Since:
1.31

lookup

public final Object lookup(Class 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, one will be returned arbitrarily. 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 final Lookup.Item lookupItem(Lookup.Template 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

lookup

public final Lookup.Result lookup(Lookup.Template 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

org.openide.util 6.8.22

Built on July 11 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.