Package com.iplanet.services.ldap
Class AttrSet
- java.lang.Object
-
- com.iplanet.services.ldap.AttrSet
-
- All Implemented Interfaces:
Serializable,Cloneable
public class AttrSet extends Object implements Serializable, Cloneable
Represents a set of attributes- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static AttrSetEMPTY_ATTR_SETEmpty Attribute Set.
-
Constructor Summary
Constructors Constructor Description AttrSet()No argument constructorAttrSet(Attr attr)Construct attribute set given an attributeAttrSet(Attr[] attrs)Construct attribute set given an array of attributes.AttrSet(Collection<org.forgerock.opendj.ldap.Attribute> ldapAttrSet)Construct AttrSet from LDAPAttributeSet
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Attr attr)Add one attribute to the AttrSet The attribute should have only string valuesvoidaddBinaryAttr(Attr attr)Add one attribute to the AttrSet The attribute should have only byte valuesObjectclone()Return a copy of the objectbooleancontains(String attrName)Check if attrSet has this attributebooleancontains(String attrName, String value)Check if this attrSet has the attribute with the given valueAttrelementAt(int index)Get the attribute at an index that starts from 0AttrgetAttribute(String name)Gets the attribute contained in the set.String[]getAttributeNames()Get names of attributes.EnumerationgetAttributes()Enumerate the attributes contained in the attribute setStringgetValue(String attrName)Gets the first string value right from a specified attributeintindexOf(String attrName)Gets the index for an attribute contained in the setvoidremove(String name)Removes an exisiting attributevoidremove(String attrName, String delValue)Remove a specified value for an attribute in the setvoidreplace(Attr attr)Replace an existing attribute.intsize()Get the number of attributes in the Attribute SetCollection<org.forgerock.opendj.ldap.Attribute>toLDAPAttributeSet()Maps to an LDAPAttributeSetStringtoString()Retrieves the string representation of an AttrSet
-
-
-
Field Detail
-
EMPTY_ATTR_SET
public static final AttrSet EMPTY_ATTR_SET
Empty Attribute Set.
-
-
Constructor Detail
-
AttrSet
public AttrSet()
No argument constructor
-
AttrSet
public AttrSet(Attr[] attrs)
Construct attribute set given an array of attributes.- Parameters:
attrs- array of attributes to be defined in the attribute set
-
AttrSet
public AttrSet(Attr attr)
Construct attribute set given an attribute- Parameters:
attr- attribute to be defined in the attribute set
-
AttrSet
public AttrSet(Collection<org.forgerock.opendj.ldap.Attribute> ldapAttrSet)
Construct AttrSet from LDAPAttributeSet- Parameters:
ldapAttrSet- LDAP attribute set
-
-
Method Detail
-
add
public void add(Attr attr)
Add one attribute to the AttrSet The attribute should have only string values- Parameters:
attr- attribute to be added to the set
-
addBinaryAttr
public void addBinaryAttr(Attr attr)
Add one attribute to the AttrSet The attribute should have only byte values- Parameters:
attr- attribute to be added to the set
-
remove
public void remove(String name)
Removes an exisiting attribute- Parameters:
name- attribute to be removed
-
remove
public void remove(String attrName, String delValue)
Remove a specified value for an attribute in the set- Parameters:
attrName- attribute name to be looked updelValue- value to be deleted for the specified attribute
-
replace
public void replace(Attr attr)
Replace an existing attribute.- Parameters:
attr- attribute to be replaced
-
getAttributeNames
public String[] getAttributeNames()
Get names of attributes.- Returns:
- Names of attributes in the set
-
getAttribute
public Attr getAttribute(String name)
Gets the attribute contained in the set. If not found returns null object- Parameters:
name- name of the attribute to get- Returns:
- attribute found
-
getAttributes
public Enumeration getAttributes()
Enumerate the attributes contained in the attribute set- Returns:
- enmeration of attributes in the set
-
getValue
public String getValue(String attrName)
Gets the first string value right from a specified attribute- Parameters:
attrName- name of the attribute to be queried in the set- Returns:
- the first string value found
-
contains
public boolean contains(String attrName)
Check if attrSet has this attribute- Parameters:
attrName- name of the attribute to be checked against the set- Returns:
- true if found and false otherwise
-
contains
public boolean contains(String attrName, String value)
Check if this attrSet has the attribute with the given value- Parameters:
attrName- name of the attribute to be checked against the setvalue- value of the attribute the attribute should contain- Returns:
- true if found and false otherwise
-
size
public int size()
Get the number of attributes in the Attribute Set- Returns:
- number of attributes in the set
-
elementAt
public Attr elementAt(int index)
Get the attribute at an index that starts from 0- Returns:
- the attribute at the given index
-
indexOf
public int indexOf(String attrName)
Gets the index for an attribute contained in the set- Returns:
- index that is zero based. If attrName is not found in the set, this method returns -1.
-
clone
public Object clone()
Return a copy of the object
-
toLDAPAttributeSet
public Collection<org.forgerock.opendj.ldap.Attribute> toLDAPAttributeSet()
Maps to an LDAPAttributeSet- Returns:
- the equivalent LDAPAttributeSet
-
-