xdc.services.spec
Class Cache

java.lang.Object
  extended by xdc.services.spec.Cache

public class Cache
extends java.lang.Object

Cache of spec objects for a session. This cache can be shared between related sessions having the same package path. For example, each BrowserSession has an associated ParserSession to handle backwards compatibility cases, and the Cache is shared in this case.


Constructor Summary
Cache()
           
 
Method Summary
 boolean contains(Node n)
          Poll whether the cache contains an object.
 boolean contains(java.lang.String qn)
          Poll whether the cache contains the named object.
 Node get(java.lang.String qn)
          Get the cached copy of an object.
 boolean put(Node n)
          Add an object to the cache.
 boolean put(java.lang.String qn, Node n)
          Add a object to the cache with a specific qualified name.
 boolean put(java.lang.String qn, Node n, boolean force)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cache

public Cache()
Method Detail

contains

public boolean contains(Node n)
Poll whether the cache contains an object.


contains

public boolean contains(java.lang.String qn)
Poll whether the cache contains the named object. Useful if the Node may not yet be fully initialized, and it may not yet be possible to call getQualName().


put

public boolean put(Node n)
Add an object to the cache.

Returns:
true if this cache did not already contain the object

put

public boolean put(java.lang.String qn,
                   Node n)
Add a object to the cache with a specific qualified name. Useful if the Node is not yet fully initialized, and it may not yet be possible to call getQualName(). If the name is known by out-of-band means then it can still be added to the cache.

Returns:
true if this cache did not already contain the object

put

public boolean put(java.lang.String qn,
                   Node n,
                   boolean force)

get

public Node get(java.lang.String qn)
Get the cached copy of an object. If the object is already in the cache, return it.

Returns:
the cached equivalent of this object, or null.