The components of a composite name are numbered. The indexes of a composite 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 composite name has no components.
When two composite names are compared, the case of the characters is significant.
A leading component separator (the composite name string begins with a separator) denotes a leading empty component (a component consisting of an empty string). A trailing component separator (the composite name string ends with a separator) denotes a trailing empty component. Adjacent component separators denote an empty component.
CompositeName).
| String Name | CompositeName |
|---|---|
| "" | {} (the empty name == new CompositeName("") == new CompositeName()) |
| "x" | {"x"} |
| "x/y" | {"x", "y"} |
| "x/" | {"x", ""} |
| "/x" | {"", "x"} |
| "/" | {""} |
| "//" | {"", ""} |
| "/x/" | {"", "x", ""} |
| "x//y" | {"x", "", "y"} |
CompositeNames. Notice that composing the
string forms of two composite names simply involves concatenating
their string forms together.
| String Names | CompositeNames |
|---|---|
| "x/y" + "/" = x/y/ | {"x", "y"} + {""} = {"x", "y", ""} |
| "" + "x" = "x" | {} + {"x"} = {"x"} |
| "/" + "x" = "/x" | {""} + {"x"} = {"", "x"} |
| "x" + "" + "" = "x" | {"x"} + {} + {} = {"x"} |
CompositeName instance is not synchronized against concurrent
multithreaded access. Multiple threads trying to access and modify a
CompositeName should lock the object.
| Modifier and Type | Field and Description |
|---|---|
| private transient NameImpl | |
| private static final long | serialVersionUID
Use serialVersionUID from JNDI 1.1.1 for interoperability
|
| Access | Constructor and Description |
|---|---|
| protected | CompositeName(Enumeration<String>
A non-null enumeration containing the components for the new
composite name. Each element is of class String.
The enumeration will be consumed to extract its
elements. comps)Constructs a new composite name instance using the components specified by 'comps'. |
| public | CompositeName(String
The non-null string to parse. n)Constructs a new composite name instance by parsing the string n using the composite name syntax (left-to-right, slash separated). |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Name | Returns: The updated CompositeName, not a new one. Cannot be null.The non-null component to add. comp)Implements javax. Adds a single component to the end of this composite name. |
| public Name | Returns: The updated CompositeName, not a new one. Cannot be null.The index at which to add the new component.
Must be in the range [0,size()]. posn, String The non-null component to add. comp)Implements javax. Adds a single component at a specified position within this composite name. |
| public Name | Returns: The updated CompositeName, not a new one. Cannot be null.The non-null components to add. suffix)Implements javax. Adds the components of a composite name -- in order -- to the end of this composite name. |
| public Name | Returns: The updated CompositeName, not a new one. Cannot be null.The index in this name at which to add the new
components. Must be in the range [0,size()]. posn, Name The non-null components to add. n)Implements javax. Adds the components of a composite name -- in order -- at a specified position within this composite name. |
| public Object | Returns: A non-null copy of this composite name.Overrides java. Implements javax. Generates a copy of this composite name. |
| public int | Returns: a negative integer, zero, or a positive integer as this Name is less than, equal to, or greater than the given Object.The non-null object to compare against. obj)Implements javax. Compares this CompositeName with the specified Object for order. |
| public boolean | Returns: true if n is a CompositeName and is a suffix of this composite name, false otherwise.The possibly null name to check. n)Implements javax. Determines whether a composite name is a suffix of this composite name. |
| public boolean | Returns: true if obj is equal to this composite name, false otherwise.The possibly null object to compare against. obj)Overrides java. Determines whether two composite names are equal. |
| public String | Returns: The non-null component at index posn.The 0-based index of the component to retrieve.
Must be in the range [0,size()). posn)Implements javax. Retrieves a component of this composite name. |
| public Enumeration | Returns: A non-null enumeration of the components of this composite name. Each element of the enumeration is of class String.Implements javax. Retrieves the components of this composite name as an enumeration of strings. |
| public Name | Returns: A composite name consisting of the components at indexes in the range [0,posn).The 0-based index of the component at which to stop.
Must be in the range [0,size()]. posn)Implements javax. Creates a composite name whose components consist of a prefix of the components in this composite name. |
| public Name | Returns: A composite name consisting of the components at indexes in the range [posn,size()). If posn is equal to size(), an empty composite name is returned.The 0-based index of the component at which to start.
Must be in the range [0,size()]. posn)Implements javax. Creates a composite name whose components consist of a suffix of the components in this composite name. |
| public int | Returns: An int representing the hash code of this name.Overrides java. Computes the hash code of this composite name. |
| public boolean | Returns: true if this composite name is empty, false otherwise.Implements javax. Determines whether this composite name is empty. |
| private void | readObject(ObjectInputStream
the s)ObjectInputStream to read fromThe readObject method is called to restore the state of
the |
| public Object | Returns: The component removed (a String).The index of the component to delete.
Must be in the range [0,size()). posn)Implements javax. Deletes a component from this composite name. |
| public int | Returns: The nonnegative number of components in this composite name.Implements javax. Retrieves the number of components in this composite name. |
| public boolean | Returns: true if n is a CompositeName and is a prefix of this composite name, false otherwise.The possibly null name to check. n)Implements javax. Determines whether a composite name is a prefix of this composite name. |
| public String | Returns: A non-null string representation of this composite name.Overrides java. Generates the string representation of this composite name. |
| private void | writeObject(ObjectOutputStream
the s)ObjectOutputStream to write toThe writeObject method is called to save the state of the
|
| impl | back to summary |
|---|---|
| private transient NameImpl impl | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides javax. Use serialVersionUID from JNDI 1.1.1 for interoperability | |
| CompositeName | back to summary |
|---|---|
| protected CompositeName(Enumeration<String> comps) Constructs a new composite name instance using the components specified by 'comps'. This protected method is intended to be used by subclasses of CompositeName when they override methods such as clone(), getPrefix(), getSuffix().
| |
| CompositeName | back to summary |
|---|---|
| public CompositeName(String n) throws InvalidNameException Constructs a new composite name instance by parsing the string n using the composite name syntax (left-to-right, slash separated). The composite name syntax is described in detail in the class description.
| |
| CompositeName | back to summary |
|---|---|
| public CompositeName() Constructs a new empty composite name. Such a name returns true
when | |
| add | back to summary |
|---|---|
| public Name add(String comp) throws InvalidNameException Implements javax. Adds a single component to the end of this composite name.
| |
| add | back to summary |
|---|---|
| public Name add(int posn, String comp) throws InvalidNameException Implements javax. Adds a single component at a specified position within this composite name. Components of this composite name at or after the index of the new component are shifted up by one (away from index 0) to accommodate the new component.
| |
| addAll | back to summary |
|---|---|
| public Name addAll(Name suffix) throws InvalidNameException Implements javax. Adds the components of a composite name -- in order -- to the end of this composite name.
| |
| addAll | back to summary |
|---|---|
| public Name addAll(int posn, Name n) throws InvalidNameException Implements javax. Adds the components of a composite name -- in order -- at a specified position within this composite name. Components of this composite name at or after the index of the first new component are shifted up (away from index 0) to accommodate the new components.
| |
| clone | back to summary |
|---|---|
| public Object clone() Overrides java. Implements javax. Generates a copy of this composite name. Changes to the components of this composite name won't affect the new copy and vice versa.
| |
| compareTo | back to summary |
|---|---|
| public int compareTo(Object obj) Implements javax. Compares this CompositeName with the specified Object for order. Returns a negative integer, zero, or a positive integer as this Name is less than, equal to, or greater than the given Object. If obj is null or not an instance of CompositeName, ClassCastException is thrown. See equals() for what it means for two composite names to be equal. If two composite names are equal, 0 is returned. Ordering of composite names follows the lexicographical rules for string comparison, with the extension that this applies to all the components in the composite name. The effect is as if all the components were lined up in their specified ordered and the lexicographical rules applied over the two line-ups. If this composite name is "lexicographically" lesser than obj, a negative number is returned. If this composite name is "lexicographically" greater than obj, a positive number is returned.
| |
| endsWith | back to summary |
|---|---|
| public boolean endsWith(Name n) Implements javax. Determines whether a composite name is a suffix of this composite name. A composite name 'n' is a suffix if it is equal to getSuffix(size()-n.size())--in other words, this composite name ends with 'n'. If n is null or not a composite name, false is returned.
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Determines whether two composite names are equal. If obj is null or not a composite name, false is returned. Two composite names are equal if each component in one is equal to the corresponding component in the other. This implies both have the same number of components, and each component's equals() test against the corresponding component in the other name returns true. | |
| get | back to summary |
|---|---|
| public String get(int posn) Implements javax. Retrieves a component of this composite name.
| |
| getAll | back to summary |
|---|---|
| public Enumeration Implements javax. Retrieves the components of this composite name as an enumeration of strings. The effects of updates to this composite name on this enumeration is undefined.
| |
| getPrefix | back to summary |
|---|---|
| public Name getPrefix(int posn) Implements javax. Creates a composite name whose components consist of a prefix of the components in this composite name. Subsequent changes to this composite name does not affect the name that is returned.
| |
| getSuffix | back to summary |
|---|---|
| public Name getSuffix(int posn) Implements javax. Creates a composite name whose components consist of a suffix of the components in this composite name. Subsequent changes to this composite name does not affect the name that is returned.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Computes the hash code of this composite name. The hash code is the sum of the hash codes of individual components of this composite name.
| |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() Implements javax. Determines whether this composite name is empty. A composite name is empty if it has zero components.
| |
| readObject | back to summary |
|---|---|
| private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException The readObject method is called to restore the state of
the
| |
| remove | back to summary |
|---|---|
| public Object remove(int posn) throws InvalidNameException Implements javax. Deletes a component from this composite name. The component of this composite name at position 'posn' is removed, and components at indices greater than 'posn' are shifted down (towards index 0) by one.
| |
| size | back to summary |
|---|---|
| public int size() Implements javax. Retrieves the number of components in this composite name.
| |
| startsWith | back to summary |
|---|---|
| public boolean startsWith(Name n) Implements javax. Determines whether a composite name is a prefix of this composite name. A composite name 'n' is a prefix if it is equal to getPrefix(n.size())--in other words, this composite name starts with 'n'. If 'n' is null or not a composite name, false is returned.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Generates the string representation of this composite name. The string representation consists of enumerating in order each component of the composite name and separating each component by a forward slash character. Quoting and escape characters are applied where necessary according to the JNDI syntax, which is described in the class description. An empty component is represented by an empty string. The string representation thus generated can be passed to the CompositeName constructor to create a new equivalent composite name.
| |
| writeObject | back to summary |
|---|---|
| private void writeObject(ObjectOutputStream s) throws IOException The writeObject method is called to save the state of the
| |