org.openide.util.lookup
Class InstanceContent
java.lang.Object
|
+--org.openide.util.lookup.AbstractLookup.Content
|
+--org.openide.util.lookup.InstanceContent
- public final class InstanceContent
- extends AbstractLookup.Content
A special content implementation that can be passed to AbstractLookup
and provides methods for registration of instances and lazy instances.
InstanceContent ic = new InstanceContent ();
AbstractLookup al = new AbstractLookup (ic);
ic.add (new Object ());
ic.add (new Dimension (...));
Dimension theDim = (Dimension)al.lookup (Dimension.class);
- Since:
- 1.25
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
InstanceContent
public InstanceContent()
add
public final void add(Object inst)
- The method to add instance to the lookup with.
- Parameters:
inst
- instance
add
public final void add(Object inst,
InstanceContent.Convertor conv)
- The method to add instance to the lookup with.
- Parameters:
inst
- instanceconv
- convertor which postponing an instantiation,
if conv==null
then the instance is registered directly.
remove
public final void remove(Object inst)
- Remove instance.
- Parameters:
inst
- instance
remove
public final void remove(Object inst,
InstanceContent.Convertor conv)
- Remove instance added with a convertor.
- Parameters:
inst
- instanceconv
- convertor, if conv==null
it is same like
remove(Object)
set
public final void set(Collection col,
InstanceContent.Convertor conv)
- Changes all pairs in the lookup to new values. Converts collection of
instances to collection of pairs.
- Parameters:
collection
- the collection of (Item) objectsconv
- the convertor to use or null
Built on December 12 2001. | Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.