Attribute interface.
This implementation does not support the schema methods
getAttributeDefinition() and getAttributeSyntaxDefinition().
They simply throw OperationNotSupportedException.
Subclasses of BasicAttribute should override these methods if they
support them.
The BasicAttribute class by default uses Object.equals() to
determine equality of attribute values when testing for equality or
when searching for values, except when the value is an array.
For an array, each element of the array is checked using Object.equals().
Subclasses of BasicAttribute can make use of schema information
when doing similar equality checks by overriding methods
in which such use of schema is meaningful.
Similarly, the BasicAttribute class by default returns the values passed to its
constructor and/or manipulated using the add/remove methods.
Subclasses of BasicAttribute can override get() and getAll()
to get the values dynamically from the directory (or implement
the Attribute interface directly instead of subclassing BasicAttribute).
Note that updates to BasicAttribute (such as adding or removing a value)
does 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.
A BasicAttribute instance is not synchronized against concurrent
multithreaded access. Multiple threads trying to access and modify a
BasicAttribute should lock the object.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv class |
| Modifier and Type | Field and Description |
|---|---|
| protected String | attrID
Holds the attribute's id. It is initialized by the public constructor and cannot be null unless methods in BasicAttribute that use attrID have been overridden. |
| protected boolean | ordered
A flag for recording whether this attribute's values are ordered. |
| private static final long | serialVersionUID
Use serialVersionUID from JNDI 1.1.1 for interoperability.
|
| protected transient Vector | values
Holds the attribute's values. |
| Access | Constructor and Description |
|---|---|
| public | BasicAttribute(String
The attribute's id. It cannot be null. id)Constructs a new instance of an unordered attribute with no value. |
| public | BasicAttribute(String
The attribute's id. It cannot be null. id, Object The attribute's value. If null, a null
value is added to the attribute. value)Constructs a new instance of an unordered attribute with a single value. |
| public | BasicAttribute(String
The attribute's id. It cannot be null. id, boolean true means the attribute's values will be ordered;
false otherwise. ordered)Constructs a new instance of a possibly ordered attribute with no value. |
| public | BasicAttribute(String
The attribute's id. It cannot be null. id, Object The attribute's value. If null, a null
value is added to the attribute. value, boolean true means the attribute's values will be ordered;
false otherwise. ordered)Constructs a new instance of a possibly ordered attribute with a single value. |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | add(Object attrVal)
Implements javax. Adds a new value to this attribute. |
| public void | add(int ix, Object attrVal)
Implements javax. Adds an attribute value to the ordered list of attribute values. |
| private static boolean | arrayEquals(Object a1, Object a2)
Determines whether two arrays are equal by comparing each of their
elements using |
| public void | |
| public Object | clone()
Overrides java. Implements javax. Makes a copy of the attribute. |
| public boolean | contains(Object attrVal)
Implements javax. Determines whether a value is in this attribute. |
| public boolean | Returns: true if obj is equal to this attribute; false otherwise.The possibly null object to check. obj)Overrides java. Determines whether obj is equal to this attribute. |
| private int | |
| public Object | |
| public Object | get(int ix)
Implements javax. Retrieves the attribute value from the ordered list of attribute values. |
| public NamingEnumeration | getAll()
Implements javax. Retrieves an enumeration of this attribute's values. |
| public DirContext | getAttributeDefinition()
Implements javax. Retrieves this attribute's schema definition. |
| public DirContext | getAttributeSyntaxDefinition()
Implements javax. Retrieves the syntax definition associated with this attribute. |
| public String | |
| public int | Returns: an int representing the hash code of this attribute.Overrides java. Calculates the hash code of this attribute. |
| public boolean | isOrdered()
Implements javax. Determines whether this attribute's values are ordered. |
| private void | readObject(ObjectInputStream
the s)ObjectInputStream to read fromThe readObject method is called to restore the state of
the |
| public boolean | remove(Object attrval)
Implements javax. Removes a specified value from this attribute. |
| public Object | remove(int ix)
Implements javax. Removes an attribute value from the ordered list of attribute values. |
| public Object | set(int ix, Object attrVal)
Implements javax. Sets an attribute value in the ordered list of attribute values. |
| public int | size()
Implements javax. Retrieves the number of values in this attribute. |
| public String | Returns: The non-null string representation of this attribute.Overrides java. Generates the string representation of this attribute. |
| private static boolean | |
| private void | writeObject(ObjectOutputStream
the s)ObjectOutputStream to write toThe writeObject method is called to save the state of the
|
| attrID | back to summary |
|---|---|
| protected String attrID Holds the attribute's id. It is initialized by the public constructor and cannot be null unless methods in BasicAttribute that use attrID have been overridden. | |
| ordered | back to summary |
|---|---|
| protected boolean ordered A flag for recording whether this attribute's values are ordered. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides javax. Use serialVersionUID from JNDI 1.1.1 for interoperability. | |
| values | back to summary |
|---|---|
| protected transient Vector<Object> values Holds the attribute's values. Initialized by public constructors. Cannot be null unless methods in BasicAttribute that use values have been overridden. | |
| BasicAttribute | back to summary |
|---|---|
| public BasicAttribute(String id) Constructs a new instance of an unordered attribute with no value.
| |
| BasicAttribute | back to summary |
|---|---|
| public BasicAttribute(String id, Object value) Constructs a new instance of an unordered attribute with a single value. | |
| BasicAttribute | back to summary |
|---|---|
| public BasicAttribute(String id, boolean ordered) Constructs a new instance of a possibly ordered attribute with no value.
| |
| BasicAttribute | back to summary |
|---|---|
| public BasicAttribute(String id, Object value, boolean ordered) Constructs a new instance of a possibly ordered attribute with a single value. | |
| add | back to summary |
|---|---|
| public boolean add(Object attrVal) Implements javax. Adds a new value to this attribute.
By default, | |
| add | back to summary |
|---|---|
| public void add(int ix, Object attrVal) Implements javax. Doc from javax. Adds an attribute value to the ordered list of attribute values.
This method adds | |
| arrayEquals | back to summary |
|---|---|
| private static boolean arrayEquals(Object a1, Object a2) Determines whether two arrays are equal by comparing each of their
elements using | |
| clear | back to summary |
|---|---|
| public void clear() Implements javax. Doc from javax. Removes all values from this attribute. | |
| clone | back to summary |
|---|---|
| public Object clone() Overrides java. Implements javax. Doc from javax. 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) Implements javax. Determines whether a value is in this attribute.
By default,
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Determines whether obj is equal to this attribute. Two attributes are equal if their attribute-ids, syntaxes and values are equal. If the attribute values are unordered, the order that the values were added are irrelevant. If the attribute values are ordered, then the order the values must match. If obj is null or not an Attribute, false is returned.
By default | |
| find | back to summary |
|---|---|
| private int find(Object target) | |
| get | back to summary |
|---|---|
| public Object get() throws NamingException Implements javax. Retrieves one of this attribute's values. By default, the value returned is one of those passed to the constructor and/or manipulated using the add/replace/remove methods. A subclass may override this to retrieve the value dynamically from the directory.
| |
| get | back to summary |
|---|---|
| public Object get(int ix) throws NamingException Implements javax. Doc from javax. Retrieves the attribute value from the ordered list of attribute values.
This method returns the value at the
| |
| getAll | back to summary |
|---|---|
| public NamingEnumeration Implements javax. Retrieves an enumeration of this attribute's values. By default, the values returned are those passed to the constructor and/or manipulated using the add/replace/remove methods. A subclass may override this to retrieve the values dynamically from the directory.
| |
| getAttributeDefinition | back to summary |
|---|---|
| public DirContext getAttributeDefinition() throws NamingException Implements javax. Retrieves this attribute's schema definition. This method by default throws OperationNotSupportedException. A subclass should override this method if it supports schema.
| |
| getAttributeSyntaxDefinition | back to summary |
|---|---|
| public DirContext getAttributeSyntaxDefinition() throws NamingException Implements javax. Retrieves the syntax definition associated with this attribute. This method by default throws OperationNotSupportedException. A subclass should override this method if it supports schema.
| |
| getID | back to summary |
|---|---|
| public String getID() Implements javax. Doc from javax. Retrieves the id of this attribute. | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Calculates the hash code of this attribute.
The hash code is computed by adding the hash code of
the attribute's id and that of all of its values except for
values that are arrays.
For an array, the hash code of each element of the array is summed.
If a subclass overrides
| |
| isOrdered | back to summary |
|---|---|
| public boolean isOrdered() Implements javax. Doc from javax. 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. | |
| 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 boolean remove(Object attrval) Implements javax. Removes a specified value from this attribute.
By default, | |
| remove | back to summary |
|---|---|
| public Object remove(int ix) Implements javax. Doc from javax. 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) Implements javax. Doc from javax. 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() Implements javax. Doc from javax. Retrieves the number of values in this attribute. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Generates the string representation of this attribute. The string consists of the attribute's id and its values. This string is meant for debugging and not meant to be interpreted programmatically.
| |
| valueEquals | back to summary |
|---|---|
| private static boolean valueEquals(Object obj1, Object obj2) Determines whether two attribute values are equal.
Use arrayEquals for arrays and | |
| writeObject | back to summary |
|---|---|
| private void writeObject(ObjectOutputStream s) throws IOException The writeObject method is called to save the state of the
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv Enumeration |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public boolean | hasMore()
Implements javax. Determines whether there are any more elements in the enumeration. |
| public boolean | hasMoreElements()
Implements java. Tests if this enumeration contains more elements. |
| public Object | next()
Implements javax. Retrieves the next element in the enumeration. |
| public Object | nextElement()
Implements java. Returns the next element of this enumeration if this enumeration object has at least one more element to provide. |
| list | back to summary |
|---|---|
| pack-priv Enumeration<Object> list | |
| ValuesEnumImpl | back to summary |
|---|---|
| pack-priv ValuesEnumImpl() | |
| close | back to summary |
|---|---|
| public void close() throws NamingException Implements javax. Doc from javax. Closes this enumeration.
After this method has been invoked on this enumeration, the
enumeration becomes invalid and subsequent invocation of any of
its methods will yield undefined results.
This method is intended for aborting an enumeration to free up resources.
If an enumeration proceeds to the end--that is, until
This method indicates to the service provider that it is free
to release resources associated with the enumeration, and can
notify servers to cancel any outstanding requests. The
| |
| hasMore | back to summary |
|---|---|
| public boolean hasMore() throws NamingException Implements javax. Doc from javax. Determines whether there are any more elements in the enumeration. This method allows naming exceptions encountered while determining whether there are more elements to be caught and handled by the application.
| |
| hasMoreElements | back to summary |
|---|---|
| public boolean hasMoreElements() Implements java. Doc from java. Tests if this enumeration contains more elements. | |
| next | back to summary |
|---|---|
| public Object next() throws NamingException Implements javax. Doc from javax. Retrieves the next element in the enumeration. This method allows naming exceptions encountered while retrieving the next element to be caught and handled by the application.
Note that
| |
| nextElement | back to summary |
|---|---|
| public Object nextElement() Implements java. Doc from java. Returns the next element of this enumeration if this enumeration object has at least one more element to provide. | |