All Packages Class Hierarchy This Package Previous Next Index
Class javax.naming.directory.BasicAttributes
java.lang.Object
|
+----javax.naming.directory.BasicAttributes
- public class BasicAttributes
- extends Object
- implements Attributes
This class provides a basic implementation
of the Attributes interface.
BasicAttributes is either case-sensitive or case-insensitive (case-ignore).
This property is determined at the time the BasicAttributes constructor
is called.
In a case-insensitive BasicAttributes, the case of its attribute identifiers
is ignored when searching for an attribute, or adding attributes.
In a case-sensitive BasicAttributes, the case is significant.
When the BasicAttributes class needs to create an Attribute, it
uses BasicAttribute. There is no other dependency on BasicAttribute.
Note that updates to BasicAttributes (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.
A BasicAttributes instance is not synchronized against concurrent
multithreaded access. Multiple threads trying to access and modify
a single BasicAttributes instance should lock the object.
The serialized form of a BasicAttributes object consists of the
ignoreCase flag (a boolean), the number of attributes in the set
(an int), and the individual BasicAttribute objects.
- See Also:
- getAttributes, modifyAttributes, bind, rebind, createSubcontext, search
-
BasicAttributes()
- Constructs a new instance of Attributes.
-
BasicAttributes(boolean)
- Constructs a new instance of Attributes.
-
BasicAttributes(String, Object)
- Constructs a new instance of Attributes with one attribute.
-
BasicAttributes(String, Object, boolean)
- Constructs a new instance of Attributes with one attribute.
-
clone()
- Makes a copy of this attribute set.
-
get(String)
- Retrieves the attribute with the given attribute id from this set.
-
getAll()
- Retrieves an enumeration of the attributes in this attribute set.
-
getIDs()
- Retrieves an enumeration of the ids of the attributes in this
attribute set.
-
isCaseIgnored()
- Determines whether this attribute set ignores the case of
attribute identifiers when retrieving or adding attributes.
-
put(Attribute)
- Adds a new attribute to this attribute set.
-
put(String, Object)
- Adds a new attribute to this attribute set.
-
remove(String)
- Removes the attribute with the attribute id 'attrID' from
this attribute set.
-
size()
- Retrieves the number of attributes in this attribute set.
-
toString()
- Generates the string representation of this attribute set.
BasicAttributes
public BasicAttributes()
- Constructs a new instance of Attributes.
The character case of attribute identifiers
is significant when subsequently retrieving or adding attributes.
BasicAttributes
public BasicAttributes(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.
BasicAttributes
public BasicAttributes(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.
BasicAttributes
public BasicAttributes(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.
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.
Changes to the copy will not affect the original and vice versa.
- Returns:
- A non-null copy of this attribute set.
- Overrides:
- clone in class Object
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.
size
public int size()
- Retrieves the number of attributes in this attribute set.
- Returns:
- The nonnegative number of attributes in this attribute set.
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
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.
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.
put
public Attribute 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
put
public Attribute 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
remove
public Attribute 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.
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