javax.naming
Class NameClassPair

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.naming.NameClassPair
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable
Direct Known Subclasses:
Binding sample code for javax.naming.Binding definition code for javax.naming.Binding

public class NameClassPair
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements Serializable sample code for java.io.Serializable definition code for java.io.Serializable

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.

Since:
1.3
See Also:
Context.list(javax.naming.Name) sample code for javax.naming.Context.list(javax.naming.Name) definition code for javax.naming.Context.list(javax.naming.Name) , Serialized Form

Constructor Summary
NameClassPair sample code for javax.naming.NameClassPair.NameClassPair(java.lang.String, java.lang.String) definition code for javax.naming.NameClassPair.NameClassPair(java.lang.String, java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  name, String sample code for java.lang.String definition code for java.lang.String  className)
          Constructs an instance of a NameClassPair given its name and class name.
NameClassPair sample code for javax.naming.NameClassPair.NameClassPair(java.lang.String, java.lang.String, boolean) definition code for javax.naming.NameClassPair.NameClassPair(java.lang.String, java.lang.String, boolean) (String sample code for java.lang.String definition code for java.lang.String  name, String sample code for java.lang.String definition code for java.lang.String  className, boolean isRelative)
          Constructs an instance of a NameClassPair given its name, class name, and whether it is relative to the listing context.
 
Method Summary
 String sample code for java.lang.String definition code for java.lang.String getClassName sample code for javax.naming.NameClassPair.getClassName() definition code for javax.naming.NameClassPair.getClassName() ()
          Retrieves the class name of the object bound to the name of this binding.
 String sample code for java.lang.String definition code for java.lang.String getName sample code for javax.naming.NameClassPair.getName() definition code for javax.naming.NameClassPair.getName() ()
          Retrieves the name of this binding.
 String sample code for java.lang.String definition code for java.lang.String getNameInNamespace sample code for javax.naming.NameClassPair.getNameInNamespace() definition code for javax.naming.NameClassPair.getNameInNamespace() ()
          Retrieves the full name of this binding.
 boolean isRelative sample code for javax.naming.NameClassPair.isRelative() definition code for javax.naming.NameClassPair.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 sample code for javax.naming.NameClassPair.setClassName(java.lang.String) definition code for javax.naming.NameClassPair.setClassName(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  name)
          Sets the class name of this binding.
 void setName sample code for javax.naming.NameClassPair.setName(java.lang.String) definition code for javax.naming.NameClassPair.setName(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  name)
          Sets the name of this binding.
 void setNameInNamespace sample code for javax.naming.NameClassPair.setNameInNamespace(java.lang.String) definition code for javax.naming.NameClassPair.setNameInNamespace(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  fullName)
          Sets the full name of this binding.
 void setRelative sample code for javax.naming.NameClassPair.setRelative(boolean) definition code for javax.naming.NameClassPair.setRelative(boolean) (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 sample code for java.lang.String definition code for java.lang.String toString sample code for javax.naming.NameClassPair.toString() definition code for javax.naming.NameClassPair.toString() ()
          Generates the string representation of this name/class pair.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

NameClassPair sample code for javax.naming.NameClassPair(java.lang.String, java.lang.String) definition code for javax.naming.NameClassPair(java.lang.String, java.lang.String)

public NameClassPair(String sample code for java.lang.String definition code for java.lang.String  name,
                     String sample code for java.lang.String definition code for java.lang.String  className)
Constructs an instance of a NameClassPair given its name and class name.

Parameters:
name - The non-null name of the object. It is relative to the target context (which is named by the first parameter of the list() method)
className - The possibly null class name of the object bound to name. It is null if the object bound is null.
See Also:
getClassName() sample code for javax.naming.NameClassPair.getClassName() definition code for javax.naming.NameClassPair.getClassName() , setClassName(java.lang.String) sample code for javax.naming.NameClassPair.setClassName(java.lang.String) definition code for javax.naming.NameClassPair.setClassName(java.lang.String) , getName() sample code for javax.naming.NameClassPair.getName() definition code for javax.naming.NameClassPair.getName() , setName(java.lang.String) sample code for javax.naming.NameClassPair.setName(java.lang.String) definition code for javax.naming.NameClassPair.setName(java.lang.String)

NameClassPair sample code for javax.naming.NameClassPair(java.lang.String, java.lang.String, boolean) definition code for javax.naming.NameClassPair(java.lang.String, java.lang.String, boolean)

public NameClassPair(String sample code for java.lang.String definition code for java.lang.String  name,
                     String sample code for java.lang.String definition code for java.lang.String  className,
                     boolean isRelative)
Constructs an instance of a NameClassPair given its name, class name, and whether it is relative to the listing context.

Parameters:
name - The non-null name of the object.
className - The possibly null class name of the object bound to name. It is null if the object bound is null.
isRelative - true if 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.
See Also:
getClassName() sample code for javax.naming.NameClassPair.getClassName() definition code for javax.naming.NameClassPair.getClassName() , setClassName(java.lang.String) sample code for javax.naming.NameClassPair.setClassName(java.lang.String) definition code for javax.naming.NameClassPair.setClassName(java.lang.String) , getName() sample code for javax.naming.NameClassPair.getName() definition code for javax.naming.NameClassPair.getName() , setName(java.lang.String) sample code for javax.naming.NameClassPair.setName(java.lang.String) definition code for javax.naming.NameClassPair.setName(java.lang.String) , isRelative() sample code for javax.naming.NameClassPair.isRelative() definition code for javax.naming.NameClassPair.isRelative() , setRelative(boolean) sample code for javax.naming.NameClassPair.setRelative(boolean) definition code for javax.naming.NameClassPair.setRelative(boolean)
Method Detail

getClassName sample code for javax.naming.NameClassPair.getClassName() definition code for javax.naming.NameClassPair.getClassName()

public String sample code for java.lang.String definition code for java.lang.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 Binding.getObject().

Returns:
The possibly null class name of object bound. It is null if the object bound is null.
See Also:
Binding.getObject() sample code for javax.naming.Binding.getObject() definition code for javax.naming.Binding.getObject() , Binding.getClassName() sample code for javax.naming.Binding.getClassName() definition code for javax.naming.Binding.getClassName() , setClassName(java.lang.String) sample code for javax.naming.NameClassPair.setClassName(java.lang.String) definition code for javax.naming.NameClassPair.setClassName(java.lang.String)

getName sample code for javax.naming.NameClassPair.getName() definition code for javax.naming.NameClassPair.getName()

public String sample code for java.lang.String definition code for java.lang.String  getName()
Retrieves the name of this binding. If isRelative() is true, this name is relative to the target context (which is named by the first parameter of the list()). If isRelative() is false, this name is a URL string.

Returns:
The non-null name of this binding.
See Also:
isRelative() sample code for javax.naming.NameClassPair.isRelative() definition code for javax.naming.NameClassPair.isRelative() , setName(java.lang.String) sample code for javax.naming.NameClassPair.setName(java.lang.String) definition code for javax.naming.NameClassPair.setName(java.lang.String)

setName sample code for javax.naming.NameClassPair.setName(java.lang.String) definition code for javax.naming.NameClassPair.setName(java.lang.String)

public void setName(String sample code for java.lang.String definition code for java.lang.String  name)
Sets the name of this binding.

Parameters:
name - the non-null string to use as the name.
See Also:
getName() sample code for javax.naming.NameClassPair.getName() definition code for javax.naming.NameClassPair.getName() , setRelative(boolean) sample code for javax.naming.NameClassPair.setRelative(boolean) definition code for javax.naming.NameClassPair.setRelative(boolean)

setClassName sample code for javax.naming.NameClassPair.setClassName(java.lang.String) definition code for javax.naming.NameClassPair.setClassName(java.lang.String)

public void setClassName(String sample code for java.lang.String definition code for java.lang.String  name)
Sets the class name of this binding.

Parameters:
name - the possibly null string to use as the class name. If null, 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.
See Also:
getClassName() sample code for javax.naming.NameClassPair.getClassName() definition code for javax.naming.NameClassPair.getClassName() , Binding.getClassName() sample code for javax.naming.Binding.getClassName() definition code for javax.naming.Binding.getClassName()

isRelative sample code for javax.naming.NameClassPair.isRelative() definition code for javax.naming.NameClassPair.isRelative()

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 list() method).

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.
See Also:
setRelative(boolean) sample code for javax.naming.NameClassPair.setRelative(boolean) definition code for javax.naming.NameClassPair.setRelative(boolean) , getName() sample code for javax.naming.NameClassPair.getName() definition code for javax.naming.NameClassPair.getName()

setRelative sample code for javax.naming.NameClassPair.setRelative(boolean) definition code for javax.naming.NameClassPair.setRelative(boolean)

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 list() method).

Parameters:
r - If true, the name of binding is relative to the target context; if false, the name of binding is a URL string.
See Also:
isRelative() sample code for javax.naming.NameClassPair.isRelative() definition code for javax.naming.NameClassPair.isRelative() , setName(java.lang.String) sample code for javax.naming.NameClassPair.setName(java.lang.String) definition code for javax.naming.NameClassPair.setName(java.lang.String)

getNameInNamespace sample code for javax.naming.NameClassPair.getNameInNamespace() definition code for javax.naming.NameClassPair.getNameInNamespace()

public String sample code for java.lang.String definition code for java.lang.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() sample code for javax.naming.Context.getNameInNamespace() definition code for javax.naming.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 sample code for java.lang.UnsupportedOperationException definition code for java.lang.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) sample code for javax.naming.NameClassPair.setNameInNamespace(java.lang.String) definition code for javax.naming.NameClassPair.setNameInNamespace(java.lang.String) , getName() sample code for javax.naming.NameClassPair.getName() definition code for javax.naming.NameClassPair.getName()

setNameInNamespace sample code for javax.naming.NameClassPair.setNameInNamespace(java.lang.String) definition code for javax.naming.NameClassPair.setNameInNamespace(java.lang.String)

public void setNameInNamespace(String sample code for java.lang.String definition code for java.lang.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() sample code for javax.naming.NameClassPair.getNameInNamespace() definition code for javax.naming.NameClassPair.getNameInNamespace() , setName(java.lang.String) sample code for javax.naming.NameClassPair.setName(java.lang.String) definition code for javax.naming.NameClassPair.setName(java.lang.String)

toString sample code for javax.naming.NameClassPair.toString() definition code for javax.naming.NameClassPair.toString()

public String sample code for java.lang.String definition code for java.lang.String  toString()
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.

Overrides:
toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
The string representation of this name/class pair.