The components of a compound name are numbered. The indexes of a compound 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 compound name has no components.
The string form of the compound name follows the syntax described above. When the components of the compound name are turned into their string representation, the reserved syntax rules described above are applied (e.g. embedded separators are escaped or quoted) so that when the same string is parsed, it will yield the same components of the original compound name.
CompoundName
instance is not synchronized against concurrent
multithreaded access. Multiple threads trying to access and modify a
CompoundName
should lock the object.
Modifier and Type | Field and Description |
---|---|
private transient NameImpl | impl
Implementation of this compound name. |
protected transient Properties | mySyntax
Syntax properties for this compound name. |
private static final long | serialVersionUID
Use serialVersionUID from JNDI 1.1.1 for interoperability
|
Access | Constructor and Description |
---|---|
protected | CompoundName(Enumeration<String>
A non-null enumeration of the components to add.
Each element of the enumeration is of class String.
The enumeration will be consumed to extract its
elements. comps, Properties A non-null properties that specify the syntax of
this compound name. See class description for
contents of properties. syntax)Constructs a new compound name instance using the components specified in comps and syntax. |
public | CompoundName(String
The non-null string to parse. n, Properties A non-null list of properties that specify the syntax of
this compound name. See class description for
contents of properties. syntax)Constructs a new compound name instance by parsing the string n using the syntax specified by the syntax properties supplied. |
Modifier and Type | Method and Description |
---|---|
public Name | Returns: The updated CompoundName, not a new one. Cannot be null.The non-null component to add. comp)Implements javax. |
public Name | Returns: The updated CompoundName, 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. |
public Name | Returns: The updated CompoundName, not a new one. Cannot be null.The non-null components to add. suffix)Implements javax. |
public Name | Returns: The updated CompoundName, 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. |
public Object | Returns: A non-null copy of this compound name.Overrides java. Implements javax. |
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. |
public boolean | Returns: true if n is a CompoundName and is a suffix of this compound name, false otherwise.The possibly null compound name to check. n)Implements javax. |
public boolean | Returns: true if obj is equal to this compound name, false otherwise.The possibly null object to compare against. obj)Overrides java. |
public String | Returns: The component at index posn.The 0-based index of the component to retrieve.
Must be in the range [0,size()). posn)Implements javax. |
public Enumeration | Returns: A non-null enumeration of the components of this compound name. Each element of the enumeration is of class String.Implements javax. |
public Name | Returns: A compound 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. |
public Name | Returns: A compound name consisting of the components at indexes in the range [posn,size()). If posn is equal to size(), an empty compound name is returned.The 0-based index of the component at which to start.
Must be in the range [0,size()]. posn)Implements javax. |
public int | Returns: An int representing the hash code of this name.Overrides java. |
public boolean | Returns: true if this compound name is empty, false otherwise.Implements javax. |
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. |
public int | Returns: The nonnegative number of components in this compound name.Implements javax. |
public boolean | Returns: true if n is a CompoundName and is a prefix of this compound name, false otherwise.The possibly null compound name to check. n)Implements javax. |
public String | Returns: A non-null string representation of this compound name.Overrides java. |
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 Implementation of this compound name. This field is initialized by the constructors and cannot be null. |
mySyntax | back to summary |
---|---|
protected transient Properties mySyntax Syntax properties for this compound name. This field is initialized by the constructors and cannot be null. It should be treated as a read-only variable by subclasses. Any necessary changes to mySyntax should be made within constructors and not after the compound name has been instantiated. |
serialVersionUID | back to summary |
---|---|
private static final long serialVersionUID Hides javax. Use serialVersionUID from JNDI 1.1.1 for interoperability |
CompoundName | back to summary |
---|---|
protected CompoundName(Enumeration<String> comps, Properties syntax) Constructs a new compound name instance using the components specified in comps and syntax. This protected method is intended to be used by subclasses of CompoundName when they override methods such as clone(), getPrefix(), getSuffix().
|
CompoundName | back to summary |
---|---|
public CompoundName(String n, Properties syntax) throws InvalidNameException Constructs a new compound name instance by parsing the string n using the syntax specified by the syntax properties supplied.
|
add | back to summary |
---|---|
public Name add(String comp) throws InvalidNameException Implements javax. Adds a single component to the end of this compound 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 compound name. Components of this compound 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 compound name -- in order -- to the end of this compound name. Implementation Note Currently the syntax properties of suffix is not used or checked. They might be in the future.
|
addAll | back to summary |
---|---|
public Name addAll(int posn, Name n) throws InvalidNameException Implements javax. Adds the components of a compound name -- in order -- at a specified position within this compound name. Components of this compound name at or after the index of the first new component are shifted up (away from index 0) to accommodate the new components. Implementation Note Currently the syntax properties of suffix is not used or checked. They might be in the future.
|
clone | back to summary |
---|---|
public Object clone() Overrides java. Implements javax. Creates a copy of this compound name. Changes to the components of this compound name won't affect the new copy and vice versa. The clone and this compound name share the same syntax.
|
compareTo | back to summary |
---|---|
public int compareTo(Object obj) Implements javax. Compares this CompoundName 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 CompoundName, ClassCastException is thrown. See equals() for what it means for two compound names to be equal. If two compound names are equal, 0 is returned. Ordering of compound names depend on the syntax of the compound name. By default, they follow lexicographical rules for string comparison with the extension that this applies to all the components in the compound name and that comparison of individual components is affected by the jndi.syntax.ignorecase and jndi.syntax.trimblanks properties, identical to how they affect equals(). If this compound name is "lexicographically" lesser than obj, a negative number is returned. If this compound name is "lexicographically" greater than obj, a positive number is returned. Implementation Note Currently the syntax properties of the two compound names are not compared when checking order. They might be in the future.
|
endsWith | back to summary |
---|---|
public boolean endsWith(Name n) Implements javax. Determines whether a compound name is a suffix of this compound name. A compound name 'n' is a suffix if it is equal to getSuffix(size()-n.size())--in other words, this compound name ends with 'n'. If n is null or not a compound name, false is returned. Implementation Note Currently the syntax properties of n are not used when doing the comparison. They might be in the future.
|
equals | back to summary |
---|---|
public boolean equals(Object obj) Overrides java. Determines whether obj is syntactically equal to this compound name. If obj is null or not a CompoundName, false is returned. Two compound names are equal if each component in one is "equal" to the corresponding component in the other. Equality is also defined in terms of the syntax of this compound name. The default implementation of CompoundName uses the syntax properties jndi.syntax.ignorecase and jndi.syntax.trimblanks when comparing two components for equality. If case is ignored, two strings with the same sequence of characters but with different cases are considered equal. If blanks are being trimmed, leading and trailing blanks are ignored for the purpose of the comparison. Both compound names must have the same number of components. Implementation Note Currently the syntax properties of the two compound names are not compared for equality. They might be in the future.
|
get | back to summary |
---|---|
public String get(int posn) Implements javax. Retrieves a component of this compound name.
|
getAll | back to summary |
---|---|
public Enumeration Implements javax. Retrieves the components of this compound name as an enumeration of strings. The effects of updates to this compound name on this enumeration is undefined.
|
getPrefix | back to summary |
---|---|
public Name getPrefix(int posn) Implements javax. Creates a compound name whose components consist of a prefix of the components in this compound name. The result and this compound name share the same syntax. Subsequent changes to this compound name do not affect the name that is returned and vice versa.
|
getSuffix | back to summary |
---|---|
public Name getSuffix(int posn) Implements javax. Creates a compound name whose components consist of a suffix of the components in this compound name. The result and this compound name share the same syntax. Subsequent changes to this compound name do not affect the name that is returned.
|
hashCode | back to summary |
---|---|
public int hashCode() Overrides java. Computes the hash code of this compound name. The hash code is the sum of the hash codes of the "canonicalized" forms of individual components of this compound name. Each component is "canonicalized" according to the compound name's syntax before its hash code is computed. For a case-insensitive name, for example, the uppercased form of a name has the same hash code as its lowercased equivalent.
|
isEmpty | back to summary |
---|---|
public boolean isEmpty() Implements javax. Determines whether this compound name is empty. A compound 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 compound name. The component of this compound 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 compound name.
|
startsWith | back to summary |
---|---|
public boolean startsWith(Name n) Implements javax. Determines whether a compound name is a prefix of this compound name. A compound name 'n' is a prefix if it is equal to getPrefix(n.size())--in other words, this compound name starts with 'n'. If n is null or not a compound name, false is returned. Implementation Note Currently the syntax properties of n are not used when doing the comparison. They might be in the future.
|
toString | back to summary |
---|---|
public String toString() Overrides java. Generates the string representation of this compound name, using the syntax rules of the compound name. The syntax rules are described in the class description. An empty component is represented by an empty string. The string representation thus generated can be passed to the CompoundName constructor with the same syntax properties to create a new equivalent compound name.
|
writeObject | back to summary |
---|---|
private void writeObject(ObjectOutputStream s) throws IOException The writeObject method is called to save the state of the
|