javax.naming
Interface Name

All Superinterfaces:
Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable , Comparable sample code for java.lang.Comparable definition code for java.lang.Comparable <Object sample code for java.lang.Object definition code for java.lang.Object >, Serializable sample code for java.io.Serializable definition code for java.io.Serializable
All Known Implementing Classes:
CompositeName sample code for javax.naming.CompositeName definition code for javax.naming.CompositeName , CompoundName sample code for javax.naming.CompoundName definition code for javax.naming.CompoundName , LdapName sample code for javax.naming.ldap.LdapName definition code for javax.naming.ldap.LdapName

public interface Name
extends Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable , Serializable sample code for java.io.Serializable definition code for java.io.Serializable , Comparable sample code for java.lang.Comparable definition code for java.lang.Comparable <Object sample code for java.lang.Object definition code for java.lang.Object >

The Name interface represents a generic name -- an ordered sequence of components. It can be a composite name (names that span multiple namespaces), or a compound name (names that are used within individual hierarchical naming systems).

There can be different implementations of Name; for example, composite names, URLs, or namespace-specific compound names.

The components of a name are numbered. The indexes of a name with N components range from 0 up to, but not including, N. This range may be written as [0,N). The most significant component is at index 0. An empty name has no components.

None of the methods in this interface accept null as a valid value for a parameter that is a name or a name component. Likewise, methods that return a name or name component never return null.

An instance of a Name may not be synchronized against concurrent multithreaded access if that access is not read-only.

Since:
1.3

Field Summary
static long serialVersionUID sample code for javax.naming.Name.serialVersionUID definition code for javax.naming.Name.serialVersionUID
          The class fingerprint that is set to indicate serialization compatibility with a previous version of the class.
 
Method Summary
 Name sample code for javax.naming.Name definition code for javax.naming.Name add sample code for javax.naming.Name.add(int, java.lang.String) definition code for javax.naming.Name.add(int, java.lang.String) (int posn, String sample code for java.lang.String definition code for java.lang.String  comp)
          Adds a single component at a specified position within this name.
 Name sample code for javax.naming.Name definition code for javax.naming.Name add sample code for javax.naming.Name.add(java.lang.String) definition code for javax.naming.Name.add(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  comp)
          Adds a single component to the end of this name.
 Name sample code for javax.naming.Name definition code for javax.naming.Name addAll sample code for javax.naming.Name.addAll(int, javax.naming.Name) definition code for javax.naming.Name.addAll(int, javax.naming.Name) (int posn, Name sample code for javax.naming.Name definition code for javax.naming.Name  n)
          Adds the components of a name -- in order -- at a specified position within this name.
 Name sample code for javax.naming.Name definition code for javax.naming.Name addAll sample code for javax.naming.Name.addAll(javax.naming.Name) definition code for javax.naming.Name.addAll(javax.naming.Name) (Name sample code for javax.naming.Name definition code for javax.naming.Name  suffix)
          Adds the components of a name -- in order -- to the end of this name.
 Object sample code for java.lang.Object definition code for java.lang.Object clone sample code for javax.naming.Name.clone() definition code for javax.naming.Name.clone() ()
          Generates a new copy of this name.
 int compareTo sample code for javax.naming.Name.compareTo(java.lang.Object) definition code for javax.naming.Name.compareTo(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  obj)
          Compares this name with another name for order.
 boolean endsWith sample code for javax.naming.Name.endsWith(javax.naming.Name) definition code for javax.naming.Name.endsWith(javax.naming.Name) (Name sample code for javax.naming.Name definition code for javax.naming.Name  n)
          Determines whether this name ends with a specified suffix.
 String sample code for java.lang.String definition code for java.lang.String get sample code for javax.naming.Name.get(int) definition code for javax.naming.Name.get(int) (int posn)
          Retrieves a component of this name.
 Enumeration sample code for java.util.Enumeration definition code for java.util.Enumeration <String sample code for java.lang.String definition code for java.lang.String > getAll sample code for javax.naming.Name.getAll() definition code for javax.naming.Name.getAll() ()
          Retrieves the components of this name as an enumeration of strings.
 Name sample code for javax.naming.Name definition code for javax.naming.Name getPrefix sample code for javax.naming.Name.getPrefix(int) definition code for javax.naming.Name.getPrefix(int) (int posn)
          Creates a name whose components consist of a prefix of the components of this name.
 Name sample code for javax.naming.Name definition code for javax.naming.Name getSuffix sample code for javax.naming.Name.getSuffix(int) definition code for javax.naming.Name.getSuffix(int) (int posn)
          Creates a name whose components consist of a suffix of the components in this name.
 boolean isEmpty sample code for javax.naming.Name.isEmpty() definition code for javax.naming.Name.isEmpty() ()
          Determines whether this name is empty.
 Object sample code for java.lang.Object definition code for java.lang.Object remove sample code for javax.naming.Name.remove(int) definition code for javax.naming.Name.remove(int) (int posn)
          Removes a component from this name.
 int size sample code for javax.naming.Name.size() definition code for javax.naming.Name.size() ()
          Returns the number of components in this name.
 boolean startsWith sample code for javax.naming.Name.startsWith(javax.naming.Name) definition code for javax.naming.Name.startsWith(javax.naming.Name) (Name sample code for javax.naming.Name definition code for javax.naming.Name  n)
          Determines whether this name starts with a specified prefix.
 

Field Detail

serialVersionUID sample code for javax.naming.Name.serialVersionUID

static final long serialVersionUID
The class fingerprint that is set to indicate serialization compatibility with a previous version of the class.

See Also:
Constant Field Values
Method Detail

clone sample code for javax.naming.Name.clone() definition code for javax.naming.Name.clone()

Object sample code for java.lang.Object definition code for java.lang.Object  clone()
Generates a new copy of this name. Subsequent changes to the components of this name will not affect the new copy, and vice versa.

Returns:
a copy of this name
See Also:
Object.clone() sample code for java.lang.Object.clone() definition code for java.lang.Object.clone()

compareTo sample code for javax.naming.Name.compareTo(java.lang.Object) definition code for javax.naming.Name.compareTo(java.lang.Object)

int compareTo(Object sample code for java.lang.Object definition code for java.lang.Object  obj)
Compares this name with another name for order. Returns a negative integer, zero, or a positive integer as this name is less than, equal to, or greater than the given name.

As with Object.equals(), the notion of ordering for names depends on the class that implements this interface. For example, the ordering may be based on lexicographical ordering of the name components. Specific attributes of the name, such as how it treats case, may affect the ordering. In general, two names of different classes may not be compared.

Specified by:
compareTo sample code for java.lang.Comparable.compareTo(T) definition code for java.lang.Comparable.compareTo(T) in interface Comparable sample code for java.lang.Comparable definition code for java.lang.Comparable <Object sample code for java.lang.Object definition code for java.lang.Object >
Parameters:
obj - the non-null object to compare against.
Returns:
a negative integer, zero, or a positive integer as this name is less than, equal to, or greater than the given name
Throws:
ClassCastException sample code for java.lang.ClassCastException definition code for java.lang.ClassCastException - if obj is not a Name of a type that may be compared with this name
See Also:
Comparable.compareTo(Object) sample code for java.lang.Comparable.compareTo(T) definition code for java.lang.Comparable.compareTo(T)

size sample code for javax.naming.Name.size() definition code for javax.naming.Name.size()

int size()
Returns the number of components in this name.

Returns:
the number of components in this name

isEmpty sample code for javax.naming.Name.isEmpty() definition code for javax.naming.Name.isEmpty()

boolean isEmpty()
Determines whether this name is empty. An empty name is one with zero components.

Returns:
true if this name is empty, false otherwise

getAll sample code for javax.naming.Name.getAll() definition code for javax.naming.Name.getAll()

Enumeration sample code for java.util.Enumeration definition code for java.util.Enumeration <String sample code for java.lang.String definition code for java.lang.String > getAll()
Retrieves the components of this name as an enumeration of strings. The effect on the enumeration of updates to this name is undefined. If the name has zero components, an empty (non-null) enumeration is returned.

Returns:
an enumeration of the components of this name, each a string

get sample code for javax.naming.Name.get(int) definition code for javax.naming.Name.get(int)

String sample code for java.lang.String definition code for java.lang.String  get(int posn)
Retrieves a component of this name.

Parameters:
posn - the 0-based index of the component to retrieve. Must be in the range [0,size()).
Returns:
the component at index posn
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if posn is outside the specified range

getPrefix sample code for javax.naming.Name.getPrefix(int) definition code for javax.naming.Name.getPrefix(int)

Name sample code for javax.naming.Name definition code for javax.naming.Name  getPrefix(int posn)
Creates a name whose components consist of a prefix of the components of this name. Subsequent changes to this name will not affect the name that is returned and vice versa.

Parameters:
posn - the 0-based index of the component at which to stop. Must be in the range [0,size()].
Returns:
a name consisting of the components at indexes in the range [0,posn).
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if posn is outside the specified range

getSuffix sample code for javax.naming.Name.getSuffix(int) definition code for javax.naming.Name.getSuffix(int)

Name sample code for javax.naming.Name definition code for javax.naming.Name  getSuffix(int posn)
Creates a name whose components consist of a suffix of the components in this name. Subsequent changes to this name do not affect the name that is returned and vice versa.

Parameters:
posn - the 0-based index of the component at which to start. Must be in the range [0,size()].
Returns:
a name consisting of the components at indexes in the range [posn,size()). If posn is equal to size(), an empty name is returned.
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if posn is outside the specified range

startsWith sample code for javax.naming.Name.startsWith(javax.naming.Name) definition code for javax.naming.Name.startsWith(javax.naming.Name)

boolean startsWith(Name sample code for javax.naming.Name definition code for javax.naming.Name  n)
Determines whether this name starts with a specified prefix. A name n is a prefix if it is equal to getPrefix(n.size()).

Parameters:
n - the name to check
Returns:
true if n is a prefix of this name, false otherwise

endsWith sample code for javax.naming.Name.endsWith(javax.naming.Name) definition code for javax.naming.Name.endsWith(javax.naming.Name)

boolean endsWith(Name sample code for javax.naming.Name definition code for javax.naming.Name  n)
Determines whether this name ends with a specified suffix. A name n is a suffix if it is equal to getSuffix(size()-n.size()).

Parameters:
n - the name to check
Returns:
true if n is a suffix of this name, false otherwise

addAll sample code for javax.naming.Name.addAll(javax.naming.Name) definition code for javax.naming.Name.addAll(javax.naming.Name)

Name sample code for javax.naming.Name definition code for javax.naming.Name  addAll(Name sample code for javax.naming.Name definition code for javax.naming.Name  suffix)
            throws InvalidNameException sample code for javax.naming.InvalidNameException definition code for javax.naming.InvalidNameException 
Adds the components of a name -- in order -- to the end of this name.

Parameters:
suffix - the components to add
Returns:
the updated name (not a new one)
Throws:
InvalidNameException sample code for javax.naming.InvalidNameException definition code for javax.naming.InvalidNameException - if suffix is not a valid name, or if the addition of the components would violate the syntax rules of this name

addAll sample code for javax.naming.Name.addAll(int, javax.naming.Name) definition code for javax.naming.Name.addAll(int, javax.naming.Name)

Name sample code for javax.naming.Name definition code for javax.naming.Name  addAll(int posn,
            Name sample code for javax.naming.Name definition code for javax.naming.Name  n)
            throws InvalidNameException sample code for javax.naming.InvalidNameException definition code for javax.naming.InvalidNameException 
Adds the components of a name -- in order -- at a specified position within this name. Components of this name at or after the index of the first new component are shifted up (away from 0) to accommodate the new components.

Parameters:
n - the components to add
posn - the index in this name at which to add the new components. Must be in the range [0,size()].
Returns:
the updated name (not a new one)
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if posn is outside the specified range
InvalidNameException sample code for javax.naming.InvalidNameException definition code for javax.naming.InvalidNameException - if n is not a valid name, or if the addition of the components would violate the syntax rules of this name

add sample code for javax.naming.Name.add(java.lang.String) definition code for javax.naming.Name.add(java.lang.String)

Name sample code for javax.naming.Name definition code for javax.naming.Name  add(String sample code for java.lang.String definition code for java.lang.String  comp)
         throws InvalidNameException sample code for javax.naming.InvalidNameException definition code for javax.naming.InvalidNameException 
Adds a single component to the end of this name.

Parameters:
comp - the component to add
Returns:
the updated name (not a new one)
Throws:
InvalidNameException sample code for javax.naming.InvalidNameException definition code for javax.naming.InvalidNameException - if adding comp would violate the syntax rules of this name

add sample code for javax.naming.Name.add(int, java.lang.String) definition code for javax.naming.Name.add(int, java.lang.String)

Name sample code for javax.naming.Name definition code for javax.naming.Name  add(int posn,
         String sample code for java.lang.String definition code for java.lang.String  comp)
         throws InvalidNameException sample code for javax.naming.InvalidNameException definition code for javax.naming.InvalidNameException 
Adds a single component at a specified position within this name. Components of this name at or after the index of the new component are shifted up by one (away from index 0) to accommodate the new component.

Parameters:
comp - the component to add
posn - the index at which to add the new component. Must be in the range [0,size()].
Returns:
the updated name (not a new one)
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if posn is outside the specified range
InvalidNameException sample code for javax.naming.InvalidNameException definition code for javax.naming.InvalidNameException - if adding comp would violate the syntax rules of this name

remove sample code for javax.naming.Name.remove(int) definition code for javax.naming.Name.remove(int)

Object sample code for java.lang.Object definition code for java.lang.Object  remove(int posn)
              throws InvalidNameException sample code for javax.naming.InvalidNameException definition code for javax.naming.InvalidNameException 
Removes a component from this name. The component of this name at the specified position is removed. Components with indexes greater than this position are shifted down (toward index 0) by one.

Parameters:
posn - the index of the component to remove. Must be in the range [0,size()).
Returns:
the component removed (a String)
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if posn is outside the specified range
InvalidNameException sample code for javax.naming.InvalidNameException definition code for javax.naming.InvalidNameException - if deleting the component would violate the syntax rules of the name