This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.naming
interface Name

All Superinterfaces:
Comparable
All Known Implementing Classes:
CompositeName, CompoundName, LdapName

Most common ways to construct:

Hashtable refEnv = …;
String JNP_PARSED_NAME = …;

Name parsedName = (Name)refEnv.get(JNP_PARSED_NAME);

Based on 7 examples

 

NameParser parser = …;
String insName = …;

Name name = parser.parse(insName);

Based on 6 examples

 

Name name = …;

Name subName = name.getPrefix(1);

Based on 6 examples


public interface Name
extends Comparable

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.


Field Summary
static long serialVersionUID
          The class fingerprint that is set to indicate serialization compatibility with a previous version of the class.
 
Method Summary
 Name
add(int posn, String comp)

          Adds a single component at a specified position within this name.
 Name
add(String comp)

          Adds a single component to the end of this name.
 Name
addAll(int posn, Name n)

          Adds the components of a name -- in order -- at a specified position within this name.
 Name
addAll(Name suffix)

          Adds the components of a name -- in order -- to the end of this name.
 Object

          Generates a new copy of this name.
 int

          Compares this name with another name for order.
 boolean

          Determines whether this name ends with a specified suffix.
 String
get(int posn)

          Retrieves a component of this name.
 Enumeration

          Retrieves the components of this name as an enumeration of strings.
 Name
getPrefix(int posn)

          Creates a name whose components consist of a prefix of the components of this name.
 Name
getSuffix(int posn)

          Creates a name whose components consist of a suffix of the components in this name.
 boolean

          Determines whether this name is empty.
 Object
remove(int posn)

          Removes a component from this name.
 int

          Returns the number of components in this name.
 boolean

          Determines whether this name starts with a specified prefix.
 
Methods inherited from class java.lang.Comparable
compareTo
 

Field Detail

serialVersionUID

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

add

public Name add(int posn,
                String comp)
         throws 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:
posn - the index at which to add the new component. Must be in the range [0,size()].
comp - the component to add
Returns:
the updated name (not a new one)
Throws:
InvalidNameException - if adding comp would violate the syntax rules of this name

add

public Name add(String comp)
         throws 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 - if adding comp would violate the syntax rules of this name

addAll

public Name addAll(int posn,
                   Name n)
            throws 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:
posn - the index in this name at which to add the new components. Must be in the range [0,size()].
n - the components to add
Returns:
the updated name (not a new one)
Throws:
InvalidNameException - if n is not a valid name, or if the addition of the components would violate the syntax rules of this name

addAll

public Name addAll(Name suffix)
            throws 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 - if suffix is not a valid name, or if the addition of the components would violate the syntax rules of this name

clone

public 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

compareTo

public int compareTo(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.

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

endsWith

public boolean endsWith(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

get

public 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

getAll

public Enumeration 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

getPrefix

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

getSuffix

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

isEmpty

public 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

remove

public Object remove(int posn)
              throws 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:
InvalidNameException - if deleting the component would violate the syntax rules of the name

size

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

Returns:
the number of components in this name

startsWith

public boolean startsWith(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


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.