站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

ObjectRef (Registry) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.registry/1 1.8

org.netbeans.api.registry
Class ObjectRef

java.lang.Object
  extended by org.netbeans.api.registry.ObjectRef

public final class ObjectRef
extends Object

Identification of the object bound in a context. Object is identified by the context in which it is bound and by its binding name.

ObjectRef instance can be stored to Context by method Context.putObject(java.lang.String, java.lang.Object). There are two options for retrieval. Calling Context.getRef(java.lang.String) method on bound ObjectRef instance returns that instance. Calling Context.getObject(java.lang.String, java.lang.Object), however, will recursively dereference ObjectRef instance and return directly object the ObjectRef points to. If ObjectRef is invalid or referenced binding does not exist the ObjectRef instance is returned.


Constructor Summary
ObjectRef(Context context, String bindingName)
          Constructs a new ObjectRef.
ObjectRef(Context rootContext, String absoluteContextName, String bindingName)
          Constructs a new instance of ObjectRef.
 
Method Summary
 boolean equals(Object o)
           
 String getBindingName()
          Binding name under which is this object bound.
 Context getContext()
          Context in which the object is bound.
 String getContextAbsoluteName()
          Absolute context name of the context in which the object is bound.
 Object getObject()
          Getter for the object referenced by this instance.
 int hashCode()
           
 boolean isValid()
          Is the object reference valid?
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ObjectRef

public ObjectRef(Context rootContext,
                 String absoluteContextName,
                 String bindingName)
Constructs a new instance of ObjectRef.

Parameters:
rootContext - root context. See Context.getRootContext()
absoluteContextName - absolute name of context relative to root context. See Context.getAbsoluteContextName()
bindingName - name of binding
Since:
1.7

ObjectRef

public ObjectRef(Context context,
                 String bindingName)
Constructs a new ObjectRef.

Parameters:
context - context
bindingName - name of binding
Since:
1.7
Method Detail

getContext

public Context getContext()
Context in which the object is bound.

Returns:
context

getContextAbsoluteName

public String getContextAbsoluteName()
Absolute context name of the context in which the object is bound.


getBindingName

public String getBindingName()
Binding name under which is this object bound.

Returns:
binding name

getObject

public Object getObject()
Getter for the object referenced by this instance.

Returns:
object or null if the object cannot be retrieved or is invalid

isValid

public boolean isValid()
Is the object reference valid?

Returns:
true if context exists

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

org.netbeans.modules.registry/1 1.8

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.