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.
BasicAttribute
| Modifier and Type | Field and Description |
|---|---|
| public static final long | serialVersionUID
Deprecated
A Use serialVersionUID from JNDI 1.1.1 for interoperability.
serialVersionUID field in an interface is
ineffectual. Do not use; no replacement.
|
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public void | |
| public void | |
| public Object | |
| public boolean | |
| public Object | Returns: A possibly null object representing one of the attribute's value. It is null if the attribute's value is null.Retrieves one of this attribute's values. |
| public Object | Returns: The possibly null attribute value at indexix;
null if the attribute value is null.The index of the value in the ordered list of attribute values.
ix)0 <= ix < size().Retrieves the attribute value from the ordered list of attribute values. |
| public NamingEnumeration | 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.Retrieves an enumeration of the attribute's values. |
| public DirContext | Returns: This attribute's schema definition. Null if the implementation supports schemas but this particular attribute does not have any schema information.Retrieves the attribute's schema definition. |
| public DirContext | Returns: The attribute's syntax definition. Null if the implementation supports schemas but this particular attribute does not have any schema information.Retrieves the syntax definition associated with the attribute. |
| public String | |
| public boolean | Returns: true if this attribute's values are ordered; false otherwise.Determines whether this attribute's values are ordered. |
| public boolean | |
| public Object | Returns: The possibly null attribute value at indexix that was removed;
null if the attribute value is null.The index of the value to remove.
ix)0 <= ix < size().Removes an attribute value from the ordered list of attribute values. |
| public Object | Returns: The possibly null attribute value at index ix that was replaced. Null if the attribute value was null.The index of the value in the ordered list of attribute values.
ix, Object 0 <= ix < size().The possibly null attribute value to use.
If null, 'null' replaces the old value. attrVal)Sets an attribute value in the ordered list of attribute values. |
| public int | Returns: The nonnegative number of values in this attribute.Retrieves the number of values in this attribute. |
| serialVersionUID | back to summary |
|---|---|
| public static final long serialVersionUID
Deprecated A Use serialVersionUID from JNDI 1.1.1 for interoperability. | |
| add | back to summary |
|---|---|
| public boolean add(Object attrVal) Adds a new value to the attribute.
If the attribute values are unordered and
Equality is determined by the implementation, which may use
| |
| add | back to summary |
|---|---|
| public void add(int ix, Object attrVal) Adds an attribute value to the ordered list of attribute values.
This method adds
| |
| clear | back to summary |
|---|---|
| public void clear() Removes all values from this attribute. | |
| clone | back to summary |
|---|---|
| public 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.
| |
| contains | back to summary |
|---|---|
| public boolean contains(Object attrVal) Determines whether a value is in the attribute.
Equality is determined by the implementation, which may use
| |
| get | back to summary |
|---|---|
| public 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.
| |
| get | back to summary |
|---|---|
| public Object get(int ix) throws NamingException Retrieves the attribute value from the ordered list of attribute values.
This method returns the value at the
| |
| getAll | back to summary |
|---|---|
| public NamingEnumeration 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.
| |
| getAttributeDefinition | back to summary |
|---|---|
| public 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.
| |
| getAttributeSyntaxDefinition | back to summary |
|---|---|
| public 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.
| |
| getID | back to summary |
|---|---|
| public String getID() Retrieves the id of this attribute.
| |
| isOrdered | back to summary |
|---|---|
| public 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.
| |
| remove | back to summary |
|---|---|
| public boolean remove(Object attrval) Removes a specified value from the attribute.
If
Equality is determined by the implementation, which may use
| |
| remove | back to summary |
|---|---|
| public Object remove(int ix) Removes an attribute value from the ordered list of attribute values.
This method removes the value at the
| |
| set | back to summary |
|---|---|
| public Object set(int ix, Object attrVal) Sets an attribute value in the ordered list of attribute values.
This method sets the value at the
| |
| size | back to summary |
|---|---|
| public int size() Retrieves the number of values in this attribute.
| |