API java : Attribute


javax.naming.directory
Interface Attribute

All Superinterfaces:
Cloneable, Serializable
All Known Implementing Classes:
BasicAttribute

public interface Attribute
extends Cloneable, Serializable

This interface represents an attribute associated with a named object.

In a directory, named objects can have associated with them attributes. The Attribute interface represents an attribute associated with a named object. An attribute contains 0 or more, possibly null, values. The attribute values can be ordered or unordered (see isOrdered()). If the values are unordered, no duplicates are allowed. If the values are ordered, duplicates are allowed.

The content and representation of an attribute and its values is defined by the attribute's schema. The schema contains information about the attribute's syntax and other properties about the attribute. See getAttributeDefinition() and getAttributeSyntaxDefinition() for details regarding how to get schema information about an attribute if the underlying directory service supports schemas.

Equality of two attributes is determined by the implementation class. A simple implementation can use Object.equals() to determine equality of attribute values, while a more sophisticated implementation might make use of schema information to determine equality. Similarly, one implementation might provide a static storage structure which simply returns the values passed to its constructor, while another implementation might define get() and getAll(). to get the values dynamically from the directory.

Note that updates to Attribute (such as adding or removing a value) do not affect the corresponding representation of the attribute in the directory. Updates to the directory can only be effected using operations in the DirContext interface.

Since:
1.3
See Also:
BasicAttribute

Field Summary
static long serialVersionUID
          Use serialVersionUID from JNDI 1.1.1 for interoperability.
 
Method Summary
 void add(int ix, Object attrVal)
          Adds an attribute value to the ordered list of attribute values.
 boolean add(Object attrVal)
          Adds a new value to the attribute.
 void clear()
          Removes all values from this attribute.
 Object clone()
          Makes a copy of the attribute.
 boolean contains(Object attrVal)
          Determines whether a value is in the attribute.
 Object get()
          Retrieves one of this attribute's values.
 Object get(int ix)
          Retrieves the attribute value from the ordered list of attribute values.
 NamingEnumeration<?> getAll()
          Retrieves an enumeration of the attribute's values.
 DirContext getAttributeDefinition()
          Retrieves the attribute's schema definition.
 DirContext getAttributeSyntaxDefinition()
          Retrieves the syntax definition associated with the attribute.
 String getID()
          Retrieves the id of this attribute.
 boolean isOrdered()
          Determines whether this attribute's values are ordered.
 Object remove(int ix)
          Removes an attribute value from the ordered list of attribute values.
 boolean remove(Object attrval)
          Removes a specified value from the attribute.
 Object set(int ix, Object attrVal)
          Sets an attribute value in the ordered list of attribute values.
 int size()
          Retrieves the number of values in this attribute.
 

Field Detail

serialVersionUID

static final long serialVersionUID
Use serialVersionUID from JNDI 1.1.1 for interoperability.

See Also:
Constant Field Values
Method Detail

getAll

NamingEnumeration<?> getAll()
                            throws NamingException
Retrieves an enumeration of the attribute's values. The behaviour of this enumeration is unspecified if the attribute's values are added, changed, or removed while the enumeration is in progress. If the attribute values are ordered, the enumeration's items will be ordered.

Returns:
A non-null enumeration of the attribute's values. Each element of the enumeration is a possibly null Object. The object's class is the class of the attribute value. The element is null if the attribute's value is null. If the attribute has zero values, an empty enumeration is returned.
Throws:
NamingException - If a naming exception was encountered while retrieving the values.
See Also:
isOrdered()

get

Object get()
           throws NamingException
Retrieves one of this attribute's values. If the attribute has more than one value and is unordered, any one of the values is returned. If the attribute has more than one value and is ordered, the first value is returned.

Returns:
A possibly null object representing one of the attribute's value. It is null if the attribute's value is null.
Throws:
NamingException - If a naming exception was encountered while retrieving the value.
NoSuchElementException - If this attribute has no values.

size

int size()
Retrieves the number of values in this attribute.

Returns:
The nonnegative number of values in this attribute.

getID

String getID()
Retrieves the id of this attribute.

Returns:
The id of this attribute. It cannot be null.

contains

boolean contains(Object attrVal)
Determines whether a value is in the attribute. Equality is determined by the implementation, which may use Object.equals() or schema information to determine equality.

Parameters:
attrVal - The possibly null value to check. If null, check whether the attribute has an attribute value whose value is null.
Returns:
true if attrVal is one of this attribute's values; false otherwise.
See Also:
Object.equals(java.lang.Object), BasicAttribute.equals(java.lang.Object)

add

boolean add(Object attrVal)
Adds a new value to the attribute. If the attribute values are unordered and attrVal is already in the attribute, this method does nothing. If the attribute values are ordered, attrVal is added to the end of the list of attribute values.

Equality is determined by the implementation, which may use Object.equals() or schema information to determine equality.

Parameters:
attrVal - The new possibly null value to add. If null, null is added as an attribute value.
Returns:
true if a value was added; false otherwise.

remove

boolean remove(Object attrval)
Removes a specified value from the attribute. If attrval is not in the attribute, this method does nothing. If the attribute values are ordered, the first occurrence of attrVal is removed and attribute values at indices greater than the removed value are shifted up towards the head of the list (and their indices decremented by one).

Equality is determined by the implementation, which may use Object.equals() or schema information to determine equality.

Parameters:
attrval - The possibly null value to remove from this attribute. If null, remove the attribute value that is null.
Returns:
true if the value was removed; false otherwise.

clear

void clear()
Removes all values from this attribute.


getAttributeSyntaxDefinition

DirContext getAttributeSyntaxDefinition()
                                        throws NamingException
Retrieves the syntax definition associated with the attribute. An attribute's syntax definition specifies the format of the attribute's value(s). Note that this is different from the attribute value's representation as a Java object. Syntax definition refers to the directory's notion of syntax.

For example, even though a value might be a Java String object, its directory syntax might be "Printable String" or "Telephone Number". Or a value might be a byte array, and its directory syntax is "JPEG" or "Certificate". For example, if this attribute's syntax is "JPEG", this method would return the syntax definition for "JPEG".

The information that you can retrieve from a syntax definition is directory-dependent.

If an implementation does not support schemas, it should throw OperationNotSupportedException. If an implementation does support schemas, it should define this method to return the appropriate information.

Returns:
The attribute's syntax definition. Null if the implementation supports schemas but this particular attribute does not have any schema information.
Throws:
OperationNotSupportedException - If getting the schema is not supported.
NamingException - If a naming exception occurs while getting the schema.

getAttributeDefinition

DirContext getAttributeDefinition()
                                  throws NamingException
Retrieves the attribute's schema definition. An attribute's schema definition contains information such as whether the attribute is multivalued or single-valued, the matching rules to use when comparing the attribute's values. The information that you can retrieve from an attribute definition is directory-dependent.

If an implementation does not support schemas, it should throw OperationNotSupportedException. If an implementation does support schemas, it should define this method to return the appropriate information.

Returns:
This attribute's schema definition. Null if the implementation supports schemas but this particular attribute does not have any schema information.
Throws:
OperationNotSupportedException - If getting the schema is not supported.
NamingException - If a naming exception occurs while getting the schema.

clone

Object clone()
Makes a copy of the attribute. The copy contains the same attribute values as the original attribute: the attribute values are not themselves cloned. Changes to the copy will not affect the original and vice versa.

Returns:
A non-null copy of the attribute.

isOrdered

boolean isOrdered()
Determines whether this attribute's values are ordered. If an attribute's values are ordered, duplicate values are allowed. If an attribute's values are unordered, they are presented in any order and there are no duplicate values.

Returns:
true if this attribute's values are ordered; false otherwise.
See Also:
get(int), remove(int), add(int, java.lang.Object), set(int, java.lang.Object)

get

Object get(int ix)
           throws NamingException
Retrieves the attribute value from the ordered list of attribute values. This method returns the value at the ix index of the list of attribute values. If the attribute values are unordered, this method returns the value that happens to be at that index.

Parameters:
ix - The index of the value in the ordered list of attribute values. 0 <= ix < size().
Returns:
The possibly null attribute value at index ix; null if the attribute value is null.
Throws:
NamingException - If a naming exception was encountered while retrieving the value.
IndexOutOfBoundsException - If ix is outside the specified range.

remove

Object remove(int ix)
Removes an attribute value from the ordered list of attribute values. This method removes the value at the ix index of the list of attribute values. If the attribute values are unordered, this method removes the value that happens to be at that index. Values located at indices greater than ix are shifted up towards the front of the list (and their indices decremented by one).

Parameters:
ix - The index of the value to remove. 0 <= ix < size().
Returns:
The possibly null attribute value at index ix that was removed; null if the attribute value is null.
Throws:
IndexOutOfBoundsException - If ix is outside the specified range.

add

void add(int ix,
         Object attrVal)
Adds an attribute value to the ordered list of attribute values. This method adds attrVal to the list of attribute values at index ix. Values located at indices at or greater than ix are shifted down towards the end of the list (and their indices incremented by one). If the attribute values are unordered and already have attrVal, IllegalStateException is thrown.

Parameters:
ix - The index in the ordered list of attribute values to add the new value. 0 <= ix <= size().
attrVal - The possibly null attribute value to add; if null, null is the value added.
Throws:
IndexOutOfBoundsException - If ix is outside the specified range.
IllegalStateException - If the attribute values are unordered and attrVal is one of those values.

set

Object set(int ix,
           Object attrVal)
Sets an attribute value in the ordered list of attribute values. This method sets the value at the ix index of the list of attribute values to be attrVal. The old value is removed. If the attribute values are unordered, this method sets the value that happens to be at that index to attrVal, unless attrVal is already one of the values. In that case, IllegalStateException is thrown.

Parameters:
ix - The index of the value in the ordered list of attribute values. 0 <= ix < size().
attrVal - The possibly null attribute value to use. If null, 'null' replaces the old value.
Returns:
The possibly null attribute value at index ix that was replaced. Null if the attribute value was null.
Throws:
IndexOutOfBoundsException - If ix is outside the specified range.
IllegalStateException - If attrVal already exists and the attribute values are unordered.

Ces informations proviennent du site de http://java.sun.com

Remarques

Contenu

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 :

Quels sont les motivations de cette démarche?

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.

Réseaux sociaux

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.

 

Nuage de mots clés

7 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.

 

Astuce pour imprimer les couleurs des cellules de tableaux : http://www.gaudry.be/ast-rf-450.html
Aucun commentaire pour cette page

© Ce document issu de l′infobrol est enregistré sous le certificat Cyber PrInterDeposit Digital Numbertection. Enregistrement IDDN n° 5329-2543
Document créé le 30/08/06 23:25, dernière modification le Vendredi 17 Juin 2011, 12:12
Source du document imprimé : http:///www.gaudry.be/java-api-rf-javax/naming/directory/Attribute.html
St.Gaudry©07.01.02
Outils (masquer)
||
Recherche (afficher)
Recherche :

Utilisateur (masquer)
Apparence (afficher)
Stats (afficher)
15838 documents
455 astuces.
550 niouzes.
3107 definitions.
447 membres.
8121 messages.

Document genere en :
0,12 seconde

Mises à jour :
Mises à jour du site
Citation (masquer)
J'adore la télévision. En fermant les yeux, c'est presque aussi bien que la radio.

Pierre-Jean Vaillard
 
l'infobrol
Nous sommes le Vendredi 22 Septembre 2017, 08:09, toutes les heures sont au format GMT+1.00 Heure, heure d'été (+1)