All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class javax.naming.directory.Attributes

java.lang.Object
   |
   +----javax.naming.directory.Attributes

public class Attributes
extends Object
implements Cloneable, Serializable
In a directory, named objects can have associated with them attributes. The Attributes class represents a collection of attributes. For example, you can request from the directory the attributes associated with an object. Those attributes are returned in the form of an Attributes instance.

Attributes in an Attributes instance are unordered. It can have zero or more attributes. ttributes is either case-sensitive or case-insensitive (case-ignore). This property is determined at the time the Attributes constructor is called. In a case-insensitive Attributes, the case of its attribute identifiers is ignored when searching for an attribute, or adding attributes. In a case-sensitive Attributes, the case is significant.

Note that updates to Attributes (such as adding or removing an attribute) does not affect the corresponding representation in the directory. Updates to the directory can only be effected using operations in the DirContext interface.

An Attributes instance is not synchronized against concurrent multithreaded access. Multiple threads trying to access and modify a single Attributes instance should lock the object.

The serialized form of an Attributes object consists of the ignoreCase flag (a boolean), the number of attributes in the set (an int), and the individual Attribute objects.

See Also:
getAttributes, modifyAttributes, bind, rebind, createSubcontext, search

Constructor Index

 o Attributes()
Constructs a new instance of Attributes.
 o Attributes(boolean)
Constructs a new instance of Attributes.
 o Attributes(String, Object)
Constructs a new instance of Attributes with one attribute.
 o Attributes(String, Object, boolean)
Constructs a new instance of Attributes with one attribute.

Method Index

 o clone()
Makes a copy of this attribute set.
 o get(String)
Retrieves the attribute with the given attribute id from this set.
 o getAll()
Retrieves an enumeration of the attributes in this attribute set.
 o getIDs()
Retrieves an enumeration of the ids of the attributes in this attribute set.
 o isCaseIgnored()
Determines whether this attribute set ignores the case of attribute identifiers when retrieving or adding attributes.
 o put(Attribute)
Adds a new attribute to this attribute set.
 o put(String, Object)
Adds a new attribute to this attribute set.
 o remove(String)
Removes the attribute with the attribute id 'attrID' from this attribute set.
 o size()
Retrieves the number of attributes in this attribute set.
 o toString()
Generates the string representation of this attribute set.

Constructors

 o Attributes
 public Attributes()
Constructs a new instance of Attributes. The character case of attribute identifiers is significant when subsequently retrieving or adding attributes.

 o Attributes
 public Attributes(boolean ignoreCase)
Constructs a new instance of Attributes. If ignoreCase is true, the character case of attribute identifiers is ignored; otherwise the case is significant.

Parameters:
ignoreCase - true means this attribute set will ignore the case of its attribute identifiers when retrieving or adding attributes; false means case is respected.
 o Attributes
 public Attributes(String attrID,
                   Object val)
Constructs a new instance of Attributes with one attribute. The attribute specified by attrID and val are added to the newly created attribute. The character case of attribute identifiers is significant when subsequently retrieving or adding attributes.

Parameters:
attrID - non-null The id of the attribute to add. If this attribute set ignores the character case of its attribute ids, the case of attrID is ignored.
val - The value of the attribute to add. If null, a null value is added to the attribute.
 o Attributes
 public Attributes(String attrID,
                   Object val,
                   boolean ignoreCase)
Constructs a new instance of Attributes with one attribute. The attribute specified by attrID and val are added to the newly created attribute. If ignoreCase is true, the character case of attribute identifiers is ignored; otherwise the case is significant.

Parameters:
attrID - non-null The id of the attribute to add. If this attribute set ignores the character case of its attribute ids, the case of attrID is ignored.
val - The value of the attribute to add. If null, a null value is added to the attribute.
ignoreCase - true means this attribute set will ignore the case of its attribute identifiers when retrieving or adding attributes; false means case is respected.

Methods

 o clone
 public Object clone()
Makes a copy of this attribute set. The new set contains the same attributes as the original set: the attributes are not themselves cloned.

Returns:
A non-null copy of this attribute set.
Overrides:
clone in class Object
 o isCaseIgnored
 public boolean isCaseIgnored()
Determines whether this attribute set ignores the case of attribute identifiers when retrieving or adding attributes.

Returns:
true if case is ignored; false otherwise.
 o size
 public int size()
Retrieves the number of attributes in this attribute set.

Returns:
The nonnegative number of attributes in this attribute set.
 o get
 public Attribute get(String attrID)
Retrieves the attribute with the given attribute id from this set. Returns null if not found.

Parameters:
attrID - The non-null id of the attribute to retrieve. If this attribute set ignores the character case of its attribute ids, the case of attrID is ignored.
Returns:
The attribute identified by attrID; null if not found.
See Also:
put, remove
 o getAll
 public NamingEnumeration getAll()
Retrieves an enumeration of the attributes in this attribute set. The effects of updates to this attribute set on this enumeration are undefined.

Returns:
A non-null enumeration of the attributes in this attribute set. Each element of the enumeration is of class Attribute. If attribute set has zero attributes, an empty enumeration is returned.
 o getIDs
 public NamingEnumeration getIDs()
Retrieves an enumeration of the ids of the attributes in this attribute set. The effects of updates to this attribute set on this enumeration are undefined.

Returns:
A non-null enumeration of the attributes' ids in this attribute set. Each element of the enumeration is of class String. If attribute set has zero attributes, an empty enumeration is returned.
 o put
 public Object put(String attrID,
                   Object val)
Adds a new attribute to this attribute set.

Parameters:
attrID - non-null The id of the attribute to add. If this attribute set ignores the character case of its attribute ids, the case of attrID is ignored.
val - The possibly null value of the attribute to add. If null, the attribute does not have any values.
Returns:
The Attribute with attrID that was previous in this attribute set; null if no such attribute existed.
See Also:
remove
 o put
 public Object put(Attribute attr)
Adds a new attribute to this attribute set.

Parameters:
attr - The non-null attribute to add. If this attribute set ignores the character case of its attribute ids, the case of attr's identifier is ignored.
Returns:
The Attribute with the same ID as attr that was previous in this attribute set; null if no such attribute existed.
See Also:
remove
 o remove
 public Object remove(String attrID)
Removes the attribute with the attribute id 'attrID' from this attribute set. If the attribute does not exist, ignore.

Parameters:
attrID - The non-null id of the attribute to remove. If this attribute set ignores the character case of its attribute ids, the case of attrID is ignored.
Returns:
The Attribute with the same ID as attr that was previous in this attribute set; null if no such attribute existed.
 o toString
 public String toString()
Generates the string representation of this attribute set. The string consists of each attribute identifier and the contents of each attribute. The contents of this string is useful for debugging and is not meant to be interpreted programmatically.

Returns:
A non-null string listing the contents of this attribute set.
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index