java.lang.Objectjavax.naming.CompositeName
This class represents a composite name -- a sequence of component names spanning multiple namespaces. Each component is a string name from the namespace of a naming system. If the component comes from a hierarchical namespace, that component can be further parsed into its atomic parts by using the CompoundName class.
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.
| 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"} |
| String Names | CompositeNames |
|---|---|
| "x/y" + "/" = x/y/ | {"x", "y"} + {""} = {"x", "y", ""} |
| "" + "x" = "x" | {} + {"x"} = {"x"} |
| "/" + "x" = "/x" | {""} + {"x"} = {"", "x"} |
| "x" + "" + "" = "x" | {"x"} + {} + {} = {"x"} |
| Constructor Summary | |
|---|---|
|
CompositeName()
Constructs a new empty composite name. |
protected |
CompositeName(Enumeration<String> comps)
Constructs a new composite name instance using the components specified by 'comps'. |
|
CompositeName(String n)
Constructs a new composite name instance by parsing the string n using the composite name syntax (left-to-right, slash separated). |
| Method Summary | |
|---|---|
Name |
add(int posn,
String comp)
Adds a single component at a specified position within this composite name. |
Name |
add(String comp)
Adds a single component to the end of this composite name. |
Name |
addAll(int posn,
Name n)
Adds the components of a composite name -- in order -- at a specified position within this composite name. |
Name |
addAll(Name suffix)
Adds the components of a composite name -- in order -- to the end of this composite name. |
Object |
clone()
Generates a copy of this composite name. |
int |
compareTo(Object obj)
Compares this CompositeName with the specified Object for order. |
boolean |
endsWith(Name n)
Determines whether a composite name is a suffix of this composite name. |
boolean |
equals(Object obj)
Determines whether two composite names are equal. |
String |
get(int posn)
Retrieves a component of this composite name. |
Enumeration<String> |
getAll()
Retrieves the components of this composite name as an enumeration of strings. |
Name |
getPrefix(int posn)
Creates a composite name whose components consist of a prefix of the components in this composite name. |
Name |
getSuffix(int posn)
Creates a composite name whose components consist of a suffix of the components in this composite name. |
int |
hashCode()
Computes the hash code of this composite name. |
boolean |
isEmpty()
Determines whether this composite name is empty. |
Object |
remove(int posn)
Deletes a component from this composite name. |
int |
size()
Retrieves the number of components in this composite name. |
boolean |
startsWith(Name n)
Determines whether a composite name is a prefix of this composite name. |
String |
toString()
Generates the string representation of this composite name. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected CompositeName(Enumeration<String> comps)
comps - 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.public CompositeName(String n) throws InvalidNameException
n - The non-null string to parse.
InvalidNameException - If n has invalid composite name syntax.public CompositeName()
isEmpty() is invoked on it.
| Method Detail |
|---|
public String toString()
public boolean equals(Object obj)
obj - The possibly null object to compare against.
hashCode()public int hashCode()
equals(java.lang.Object)public int compareTo(Object obj)
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.
compareTo in interface Comparable<Object>compareTo in interface Nameobj - The non-null object to compare against.
ClassCastException - if obj is not a CompositeName.Comparable.compareTo(Object)public Object clone()
Cloneablepublic int size()
public boolean isEmpty()
public Enumeration<String> getAll()
public String get(int posn)
posn - The 0-based index of the component to retrieve.
Must be in the range [0,size()).
ArrayIndexOutOfBoundsException - if posn is outside the
specified range.public Name getPrefix(int posn)
posn - The 0-based index of the component at which to stop.
Must be in the range [0,size()].
ArrayIndexOutOfBoundsException - If posn is outside the specified range.public Name getSuffix(int posn)
posn - The 0-based index of the component at which to start.
Must be in the range [0,size()].
ArrayIndexOutOfBoundsException - If posn is outside the specified range.public boolean startsWith(Name n)
startsWith in interface Namen - The possibly null name to check.
public boolean endsWith(Name n)
n - The possibly null name to check.
public Name addAll(Name suffix) throws InvalidNameException
suffix - The non-null components to add.
InvalidNameException - If suffix is not a composite name.public Name addAll(int posn, Name n) throws InvalidNameException
n - The non-null components to add.posn - The index in this name at which to add the new
components. Must be in the range [0,size()].
InvalidNameException - If n is not a composite name.
ArrayIndexOutOfBoundsException - If posn is outside the specified range.public Name add(String comp) throws InvalidNameException
comp - The non-null component to add.
InvalidNameException - If adding comp at end of the name
would violate the name's syntax.public Name add(int posn, String comp) throws InvalidNameException
comp - The non-null component to add.posn - The index at which to add the new component.
Must be in the range [0,size()].
ArrayIndexOutOfBoundsException - If posn is outside the specified range.
InvalidNameException - If adding comp at the specified position
would violate the name's syntax.public Object remove(int posn) throws InvalidNameException
posn - The index of the component to delete.
Must be in the range [0,size()).
ArrayIndexOutOfBoundsException - If posn is outside the specified range (includes case where
composite name is empty).
InvalidNameException - If deleting the component
would violate the name's syntax.Ces informations proviennent du site de http://java.sun.com
Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :
Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.
Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.
Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.
Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.
Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.
Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.
6 mots clés dont 0 définis manuellement (plus d'information...).
Avertissement
Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.
Recherche (afficher)
Utilisateur (masquer)
Navigation (masquer)
Apparence (afficher)
Stats (afficher)
Citation (masquer)