This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 20550

Summary: Lightweight and better lookup implementation
Product: platform Reporter: Jaroslav Tulach <jtulach>
Component: LookupAssignee: David Strupl <dstrupl>
Status: VERIFIED FIXED    
Severity: blocker    
Priority: P2    
Version: 3.x   
Hardware: PC   
OS: Linux   
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on: 32203    
Bug Blocks:    

Description Jaroslav Tulach 2002-02-14 15:17:57 UTC
In long term we want to move from Node.Cookie getCookie methods and replace them
by universal Lookup. Something like that has already been done in Looks and
Actions APIs.

During the usage I have realized that it is relatively hard to create a lookup
instance. Especially for simple case like immutable lookup of single existing
object(s). One can use 

InstanceContent ic = new InstanceContent ();
ic.add (singleton);
return new AbstractLookup (ic);

but the code is long and the memory representation of such object is overkilling
the actual need (because the lookup will never change).

That is why I suggest to create factory methods:

public static Lookup singleton (Object objectToLookup);
public static Lookup fixed (Object[] objectsToLookup);
public static Lookup fixed (Object[] keys, InstanceContent.Convertor convertor);

Or something like this with memory representation as small as possible.
Comment 1 Jaroslav Tulach 2002-02-20 16:53:13 UTC
Why wait? The sooner implemented the more people will use it. What
about 3.4 P4?
Comment 2 David Strupl 2002-02-20 16:55:31 UTC
It does not mean I cannot work on it now. Smaller commitment ;-)
Comment 3 David Strupl 2002-05-28 16:27:10 UTC
Added to release 3.4.
Comment 4 Jaroslav Tulach 2003-07-14 15:26:20 UTC
Lookups is there. It might be even lighter, but it there.