CompoundName (Java SE 15 & JDK 15) (original) (raw)

All Implemented Interfaces:

[Serializable](../../../java.base/java/io/Serializable.html "interface in java.io"), [Cloneable](../../../java.base/java/lang/Cloneable.html "interface in java.lang"), [Comparable](../../../java.base/java/lang/Comparable.html "interface in java.lang")<[Object](../../../java.base/java/lang/Object.html "class in java.lang")>, [Name](Name.html "interface in javax.naming")


public class CompoundName extends Object implements Name

This class represents a compound name -- a name from a hierarchical name space. Each component in a compound name is an atomic name.

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.

Compound Name Syntax

The syntax of a compound name is specified using a set of properties:

jndi.syntax.direction

Direction for parsing ("right_to_left", "left_to_right", "flat"). If unspecified, defaults to "flat", which means the namespace is flat with no hierarchical structure.

jndi.syntax.separator

Separator between atomic name components. Required unless direction is "flat".

jndi.syntax.ignorecase

If present, "true" means ignore the case when comparing name components. If its value is not "true", or if the property is not present, case is considered when comparing name components.

jndi.syntax.escape

If present, specifies the escape string for overriding separator, escapes and quotes.

jndi.syntax.beginquote

If present, specifies the string delimiting start of a quoted string.

jndi.syntax.endquote

String delimiting end of quoted string. If present, specifies the string delimiting the end of a quoted string. If not present, use syntax.beginquote as end quote.

jndi.syntax.beginquote2

Alternative set of begin/end quotes.

jndi.syntax.endquote2

Alternative set of begin/end quotes.

jndi.syntax.trimblanks

If present, "true" means trim any leading and trailing whitespaces in a name component for comparison purposes. If its value is not "true", or if the property is not present, blanks are significant.

jndi.syntax.separator.ava

If present, specifies the string that separates attribute-value-assertions when specifying multiple attribute/value pairs. (e.g. "," in age=65,gender=male).

jndi.syntax.separator.typeval

If present, specifies the string that separates attribute from value (e.g. "=" in "age=65")

These properties are interpreted according to the following rules:

  1. In a string without quotes or escapes, any instance of the separator delimits two atomic names. Each atomic name is referred to as a component.
  2. A separator, quote or escape is escaped if preceded immediately (on the left) by the escape.
  3. If there are two sets of quotes, a specific begin-quote must be matched by its corresponding end-quote.
  4. A non-escaped begin-quote which precedes a component must be matched by a non-escaped end-quote at the end of the component. A component thus quoted is referred to as a_quoted component_. It is parsed by removing the being- and end- quotes, and by treating the intervening characters as ordinary characters unless one of the rules involving quoted components listed below applies.
  5. Quotes embedded in non-quoted components are treated as ordinary strings and need not be matched.
  6. A separator that is escaped or appears between non-escaped quotes is treated as an ordinary string and not a separator.
  7. An escape string within a quoted component acts as an escape only when followed by the corresponding end-quote string. This can be used to embed an escaped quote within a quoted component.
  8. An escaped escape string is not treated as an escape string.
  9. An escape string that does not precede a meta string (quotes or separator) and is not at the end of a component is treated as an ordinary string.
  10. A leading separator (the compound name string begins with a separator) denotes a leading empty atomic component (consisting of an empty string). A trailing separator (the compound name string ends with a separator) denotes a trailing empty atomic component. Adjacent separators denote an empty atomic component.

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.

Multithreaded Access

A CompoundName instance is not synchronized against concurrent multithreaded access. Multiple threads trying to access and modify aCompoundName should lock the object.

Since:

1.3

See Also:

Serialized Form

Fields

Modifier and Type Field Description
protected Properties mySyntax Syntax properties for this compound name.

Constructors

Modifier Constructor Description
CompoundName​(String n,Properties syntax) Constructs a new compound name instance by parsing the string n using the syntax specified by the syntax properties supplied.
protected CompoundName​(Enumeration<String> comps,Properties syntax) Constructs a new compound name instance using the components specified in comps and syntax.
Modifier and Type Method Description
Name add​(int posn,String comp) Adds a single component at a specified position within this compound name.
Name add​(String comp) Adds a single component to the end of this compound name.
Name addAll​(int posn,Name n) Adds the components of a compound name -- in order -- at a specified position within this compound name.
Name addAll​(Name suffix) Adds the components of a compound name -- in order -- to the end of this compound name.
Object clone() Creates a copy of this compound name.
int compareTo​(Object obj) Compares this CompoundName with the specified Object for order.
boolean endsWith​(Name n) Determines whether a compound name is a suffix of this compound name.
boolean equals​(Object obj) Determines whether obj is syntactically equal to this compound name.
String get​(int posn) Retrieves a component of this compound name.
Enumeration<String> getAll() Retrieves the components of this compound name as an enumeration of strings.
Name getPrefix​(int posn) Creates a compound name whose components consist of a prefix of the components in this compound name.
Name getSuffix​(int posn) Creates a compound name whose components consist of a suffix of the components in this compound name.
int hashCode() Computes the hash code of this compound name.
boolean isEmpty() Determines whether this compound name is empty.
Object remove​(int posn) Deletes a component from this compound name.
int size() Retrieves the number of components in this compound name.
boolean startsWith​(Name n) Determines whether a compound name is a prefix of this compound name.
String toString() Generates the string representation of this compound name, using the syntax rules of the compound name.