is new.
java.lang.Objectjavax.naming.NameClassPair
This class represents the object name and class name pair of a binding found in a context.
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.
| Constructor Summary | |
|---|---|
|
NameClassPair
(
String
name,
String
Constructs an instance of a NameClassPair given its name and class name. |
|
|
NameClassPair
(
String
name,
String
Constructs an instance of a NameClassPair given its name, class name, and whether it is relative to the listing context. |
|
| Method Summary | |
|---|---|
| String |
getClassName
() Retrieves the class name of the object bound to the name of this binding. |
| String |
getName
() Retrieves the name of this binding. |
String
|
getNameInNamespace
Retrieves
full
name of this
binding.
|
boolean
|
isRelative
()
Determines whether the name of this binding is relative to the target context (which is named by the first parameter of the list() method).
|
| void |
setClassName
(
String
name) Sets the class name of this binding. |
| void |
setName
(
String
name) Sets the name of this binding. |
| void |
setNameInNamespace
(
String
Sets
full
name of this
binding.
|
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 list() method).
|
| String |
toString
() Generates the string representation of this name/class pair. |
| Methods inherited from class java.lang. Object |
|---|
| clone , equals , finalize , getClass , hashCode , notify , notifyAll , wait , wait , wait |
| Constructor Detail |
|---|
public NameClassPair(String name,
String className)
relative to
object bound
public NameClassPair(String name,
String className,
boolean isRelative)
parameter of
name is
| Method Detail |
|---|
public String getClassName()
public String getName()
public void setName(String name)
public void setClassName(String name)
public boolean isRelative()
by the
the target context; false
public void setRelative(boolean r)
context; if
getNameInNamespace
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
Context.getNameInNamespace()
.
In naming systems for which the notion of full name does not apply to this binding an
UnsupportedOperationException
is thrown. This exception is also thrown when a service provider written before the introduction of the method is in use.
The string returned by this method is not a JNDI composite name and should not be passed directly to context methods.
Returns:
The full name of this binding.
Throws:
UnsupportedOperationException
- if the notion of full name does not apply to this binding in the naming system.
Since:
1.5
See Also:
setNameInNamespace(java.lang.String)
,
getName()
setNameInNamespace
public void
setNameInNamespace
(
String
fullName)
Sets the full name of this binding. This method must be called to set the full name whenever a
NameClassPair
is created and a full name is applicable to this binding.
Setting the full name to null, or not setting it at all, will cause
getNameInNamespace()
to throw an exception.
Parameters:
fullName - The full name to use.
Since:
1.5
See Also:
getNameInNamespace()
,
setName(java.lang.String)
public String toString()