All Packages Class Hierarchy This Package Previous Next Index
Interface java.naming.Name
- public interface Name
- extends Serializable
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 hierarchical naming systems).
There can be different implementations of Name (e.g. composite names,
URLs, 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). An empty name has no components.
-
appendComponent(String)
- Adds a single component to the end of this name.
-
appendName(Name)
- Adds the components of a name -- in order -- to the end of this name.
-
clone()
- Generates a copy of this name.
-
deleteComponent(int)
- Deletes a component from this name.
-
equals(Object)
- Determines whether two names are equal.
-
getComponent(int)
- Retrieves a component of this name.
-
getComponentCount()
- Retrieves the number of components in this name.
-
getComponents()
- Retrieves the components of this name as an enumeration
of strings.
-
getPrefix(int)
- Retrieves a name whose components consist of a prefix of the
components in this name.
-
getSuffix(int)
- Retrieves a name whose components consist of a suffix of the
components in this name.
-
hashCode()
- Computes the hash code of this name.
-
insertComponent(int, String)
- Adds a single component at a specified position within this name.
-
insertName(int, Name)
- Adds the components of a name -- in order -- at a specified position
within this name.
-
isEmpty()
- Determines whether this name is empty.
-
isPrefix(Name)
- Determines whether a name is a prefix of this name.
-
isSuffix(Name)
- Determines whether a name is a suffix of this name.
-
prependComponent(String)
- Adds a single component to the start of this name.
-
prependName(Name)
- Adds the components of a name -- in order -- to the beginning of
this name.
-
toString()
- Generates the string representation of this name.
toString
public abstract String toString()
- Generates the string representation of this name.
- Returns:
- A string representation of this name.
- Overrides:
- toString in class Object
equals
public abstract boolean equals(Object obj)
- Determines whether two names are equal.
Two names are equal if each component in one is equal
to the corresponding component in the other.
- Parameters:
- obj - The object to compare against.
- Returns:
- true if obj is equal to this name, false otherwise.
- Overrides:
- equals in class Object
hashCode
public abstract int hashCode()
- Computes the hash code of this name.
- Returns:
- The hash code computed using characters from this name.
- Overrides:
- hashCode in class Object
clone
public abstract Object clone()
- Generates a copy of this name.
- Returns:
- A copy of this name.
- Overrides:
- clone in class Object
getComponentCount
public abstract int getComponentCount()
- Retrieves the number of components in this name.
- Returns:
- The number of components in this name.
isEmpty
public abstract boolean isEmpty()
- Determines whether this name is empty.
- Returns:
- true if this name is empty, false otherwise.
getComponents
public abstract StringEnumeration getComponents()
- Retrieves the components of this name as an enumeration
of strings.
- Returns:
- An enumeration of the components of this name.
getComponent
public abstract String getComponent(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,getComponentCount()).
- Returns:
- The component at index posn.
getPrefix
public abstract Name getPrefix(int posn)
- Retrieves a name whose components consist of a prefix of the
components in this name.
- Parameters:
- posn - The 0-based index of the component at which to stop.
Must be in the range [0,getComponentCount()].
- Returns:
- A name consisting of the components at indexes in
the range [0,posn).
getSuffix
public abstract Name getSuffix(int posn)
- Retrieves a name whose components consist of a suffix of the
components in this name.
- Parameters:
- posn - The 0-based index of the component at which to start.
Must be in the range [0,getComponentCount()].
- Returns:
- A name consisting of the components at indexes in
the range [posn,getComponentCount()). If posn is equal to
getComponentCount(), an empty name is returned.
isPrefix
public abstract boolean isPrefix(Name n)
- Determines whether a name is a prefix of this name.
A name 'n' is a prefix if it is equal to getPrefix(n.getComponentCount()).
- Parameters:
- n - The name to check.
- Returns:
- true if n is a prefix of this name, false otherwise.
isSuffix
public abstract boolean isSuffix(Name n)
- Determines whether a name is a suffix of this name.
A name 'n' is a suffix if it it is equal to
getSuffix(getComponentCount()-n.getComponentCount()).
- Parameters:
- n - The name to check.
- Returns:
- true if n is a suffix of this name, false otherwise.
prependName
public abstract void prependName(Name prefix) throws InvalidNameException
- Adds the components of a name -- in order -- to the beginning of
this name.
- Parameters:
- prefix - The components to add.
appendName
public abstract void appendName(Name suffix) throws InvalidNameException
- Adds the components of a name -- in order -- to the end of this name.
- Parameters:
- suffix - The components to add.
insertName
public abstract void insertName(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 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,getComponentCount()].
prependComponent
public abstract void prependComponent(String comp) throws InvalidNameException
- Adds a single component to the start of this name.
- Parameters:
- comp - The component to add.
appendComponent
public abstract void appendComponent(String comp) throws InvalidNameException
- Adds a single component to the end of this name.
- Parameters:
- comp - The component to add.
insertComponent
public abstract void insertComponent(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 by one 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,getComponentCount()].
deleteComponent
public abstract void deleteComponent(int posn) throws InvalidNameException
- Deletes a component from this name.
- Parameters:
- posn - The index of the component to delete.
Must be in the range [0,getComponentCount()].
All Packages Class Hierarchy This Package Previous Next Index