A context consists of name-to-object bindings. The NameClassPair class represents the name and the class of the bound object. It consists of a name and a string representing the package-qualified class name.
Use subclassing for naming systems that generate contents of a name/class pair dynamically.
A NameClassPair instance is not synchronized against concurrent access by multiple threads. Threads that need to access a NameClassPair concurrently should synchronize amongst themselves and provide the necessary locking.
Context#list
| Modifier and Type | Field and Description |
|---|---|
| private String | className
Contains the class name contained in this NameClassPair. |
| private String | fullName
Contains the full name of this NameClassPair within its own namespace. |
| private boolean | isRel
Records whether the name of this |
| private String | name
Contains the name of this NameClassPair. |
| private static final long | serialVersionUID
Use serialVersionUID from JNDI 1.1.1 for interoperability |
| Access | Constructor and Description |
|---|---|
| public | NameClassPair(String
The non-null name of the object. It is relative
to the target context (which is
named by the first parameter of the name, String list() method)The possibly null class name of the object
bound to name. It is null if the object bound is null. className)Constructs an instance of a NameClassPair given its name and class name. |
| public | NameClassPair(String
The non-null name of the object. name, String The possibly null class name of the object
bound to name. It is null if the object bound is null. className, boolean true if isRelative)name is a name relative
to the target context (which is named by the first parameter
of the list() method); false if name
is a URL string.Constructs an instance of a NameClassPair given its name, class name, and whether it is relative to the listing context. |
| Modifier and Type | Method and Description |
|---|---|
| public String | Returns: The possibly null class name of object bound. It is null if the object bound is null.Retrieves the class name of the object bound to the name of this binding. |
| public String | |
| public String | |
| public boolean | Returns: true if the name of this binding is relative to the target context; false if the name of this binding is a URL string.Determines whether the name of this binding is
relative to the target context (which is named by
the first parameter of the |
| public void | setClassName(String
the possibly null string to use as the class name.
If null, name)Binding.getClassName() will return
the actual class name of the object in the binding.
The class name will be null if the object bound is null.Sets the class name of this binding. |
| public void | |
| public void | |
| public void | setRelative(boolean
If true, the name of binding is relative to the target context;
if false, the name of binding is a URL string. r)Sets whether the name of this binding is relative to the target
context (which is named by the first parameter of the |
| public String | Returns: The string representation of this name/class pair.Overrides java. Generates the string representation of this name/class pair. |
| className | back to summary |
|---|---|
| private String className Contains the class name contained in this NameClassPair.
It is initialized by the constructor and can be updated using
| |
| fullName | back to summary |
|---|---|
| private String fullName Contains the full name of this NameClassPair within its
own namespace.
It is initialized using
| |
| isRel | back to summary |
|---|---|
| private boolean isRel Records whether the name of this
| |
| name | back to summary |
|---|---|
| private String name Contains the name of this NameClassPair.
It is initialized by the constructor and can be updated using
| |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Use serialVersionUID from JNDI 1.1.1 for interoperability | |
| NameClassPair | back to summary |
|---|---|
| public NameClassPair(String name, String className) Constructs an instance of a NameClassPair given its name and class name.
| |
| NameClassPair | back to summary |
|---|---|
| public NameClassPair(String name, String className, boolean isRelative) Constructs an instance of a NameClassPair given its name, class name, and whether it is relative to the listing context.
| |
| getClassName | back to summary |
|---|---|
| public String getClassName() Retrieves the class name of the object bound to the name of this binding.
If a reference or some other indirect information is bound,
retrieves the class name of the eventual object that
will be returned by
| |
| getName | back to summary |
|---|---|
| public String getName() Retrieves the name of this binding.
If
| |
| getNameInNamespace | back to summary |
|---|---|
| public String getNameInNamespace() Retrieves the full name of this binding.
The full name is the absolute name of this binding within
its own namespace. See
In naming systems for which the notion of full name does not
apply to this binding an The string returned by this method is not a JNDI composite name and should not be passed directly to context methods.
| |
| isRelative | back to summary |
|---|---|
| public boolean isRelative() Determines whether the name of this binding is
relative to the target context (which is named by
the first parameter of the
| |
| setClassName | back to summary |
|---|---|
| public void setClassName(String name) Sets the class name of this binding.
| |
| setName | back to summary |
|---|---|
| public void setName(String name) Sets the name of this binding.
| |
| setNameInNamespace | back to summary |
|---|---|
| public void setNameInNamespace(String fullName) Sets the full name of this binding.
This method must be called to set the full name whenever a
Setting the full name to null, or not setting it at all, will
cause
| |
| setRelative | back to summary |
|---|---|
| public void setRelative(boolean r) Sets whether the name of this binding is relative to the target
context (which is named by the first parameter of the
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Generates the string representation of this name/class pair. The string representation consists of the name and class name separated by a colon (':'). The contents of this string is useful for debugging and is not meant to be interpreted programmatically.
| |