Home » openjdk-7 » javax » naming » [javadoc | source]
javax.naming
public class: NameClassPair [javadoc | source]
java.lang.Object
   javax.naming.NameClassPair

All Implemented Interfaces:
    java$io$Serializable

Direct Known Subclasses:
    Binding, SearchResult

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:
 public NameClassPair(String name,
    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.
    Also see:
    getClassName
    setClassName
    getName
    setName
 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.
    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.
    Also see:
    getClassName
    setClassName
    getName
    setName
    isRelative
    setRelative
Method from javax.naming.NameClassPair Summary:
getClassName,   getName,   getNameInNamespace,   isRelative,   setClassName,   setName,   setNameInNamespace,   setRelative,   toString
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.naming.NameClassPair Detail:
 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 Binding.getObject().
 public 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.
 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.

 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).
 public  void setClassName(String name) 
    Sets the class name of this binding.
 public  void setName(String name) 
    Sets the name of this binding.
 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.

 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).
 public 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.