Package com.iplanet.services.ldap
Class Attr
- java.lang.Object
-
- com.iplanet.services.ldap.Attr
-
- All Implemented Interfaces:
Serializable,Cloneable
public class Attr extends Object implements Serializable, Cloneable
Represents an attribute value pair in UMS. The value of an attribute can be of multiple values.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Attr()Default constructorAttr(String name)Constructs an attribute value pair with no value.Attr(String name, byte[] value)Constructs an attribute value pair with byte array.Attr(String name, byte[][] value)Constructs an attribute value pair with array of byte array.Attr(String name, String value)Construct an attribute value pair with a single string value.Attr(String name, String[] value)Construct an attribute value pair with a multiple string values.Attr(org.forgerock.opendj.ldap.Attribute attr)Construct an attribute based on a LDAP attribute
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddValue(byte[] value)Add a byte array value to the attributevoidaddValue(String value)Add a string value to the attributevoidaddValues(byte[][] values)Add a list byte array values to the attributevoidaddValues(String[] values)Add mulitple string values to the attributeObjectclone()Return a copy of the objectbooleancontains(byte[] value)Checks whether the given value already exist for the attributebooleancontains(String value)Checks whether the given value already exist for the attributeStringgetBaseName()Get base name for the attribute. e.g, the base name of "cn;lang-en" or "cn;lang-ja" is "cn"static StringgetBaseName(String attrName)Get base name for an attribute name. e.g, the base name of "cn;lang-en" or "cn;lang-ja" is "cn"byte[]getByteValue()Get one byte[] value of the attribute Returning a colletion would be better, but will not be consistent with the method getStringValues()byte[][]getByteValues()Get the byte[] values of the attributeStringgetName()Get name of an UMS attributestatic StringgetName(String attrName, Locale locale)Get attribute name with locale input.StringgetName(Locale locale)Get name of attribute in a given LocaleString[]getStringValues()Get the string values of the attributeStringgetValue()Get one string value of the attributevoidremoveValue(byte[] value)Remove a specified string value in the attributevoidremoveValue(String value)Remove a specified string value in the attributevoidsetValue(byte[] value)Set value of an attributevoidsetValue(String value)Set value of an attributeintsize()Get the number of values of the attributeorg.forgerock.opendj.ldap.AttributetoLDAPAttribute()Map to a ldap attributeStringtoString()Retrieves the string representation of an attribute
-
-
-
Constructor Detail
-
Attr
public Attr()
Default constructor
-
Attr
public Attr(String name)
Constructs an attribute value pair with no value.- Parameters:
name- attribute name
-
Attr
public Attr(String name, String value)
Construct an attribute value pair with a single string value.- Parameters:
name- the name of attributevalue- string value of attribute
-
Attr
public Attr(String name, String[] value)
Construct an attribute value pair with a multiple string values.- Parameters:
name- the name of attributevalue- multiple string values of attribute
-
Attr
public Attr(String name, byte[] value)
Constructs an attribute value pair with byte array.- Parameters:
name- attribute namevalue- byte array as input for value
-
Attr
public Attr(String name, byte[][] value)
Constructs an attribute value pair with array of byte array.- Parameters:
name- attribute namevalue- array of byte array as input for value
-
Attr
public Attr(org.forgerock.opendj.ldap.Attribute attr)
Construct an attribute based on a LDAP attribute- Parameters:
attr- ldap attribute to construct from
-
-
Method Detail
-
toLDAPAttribute
public org.forgerock.opendj.ldap.Attribute toLDAPAttribute()
Map to a ldap attribute- Returns:
- an ldap attribute
-
setValue
public void setValue(String value)
Set value of an attribute- Parameters:
value- the attribute value to be set
-
addValue
public void addValue(String value)
Add a string value to the attribute- Parameters:
value- value to be added to the attribute
-
addValues
public void addValues(String[] values)
Add mulitple string values to the attribute- Parameters:
values- string values to be added to the attribute
-
removeValue
public void removeValue(String value)
Remove a specified string value in the attribute- Parameters:
value- specified value to be remvoed from the value array
-
setValue
public void setValue(byte[] value)
Set value of an attribute- Parameters:
value- the attribute value to be set
-
addValue
public void addValue(byte[] value)
Add a byte array value to the attribute- Parameters:
value- byte array value to be added to the attribute
-
addValues
public void addValues(byte[][] values)
Add a list byte array values to the attribute- Parameters:
values- of byte array values to be added to the attribute
-
removeValue
public void removeValue(byte[] value)
Remove a specified string value in the attribute- Parameters:
value- specified value to be remvoed from the value array
-
getName
public String getName()
Get name of an UMS attribute- Returns:
- name of an UMS attribute
-
getName
public String getName(Locale locale)
Get name of attribute in a given Locale- Parameters:
locale- Given locale for the attribute name to return- Returns:
- name of an UMS attribute
-
getName
public static String getName(String attrName, Locale locale)
Get attribute name with locale input.- Parameters:
attrName- name of the attributelocale- desired locale for the attribute- Returns:
- attribute name with locale attached for retrieval
-
getBaseName
public String getBaseName()
Get base name for the attribute. e.g, the base name of "cn;lang-en" or "cn;lang-ja" is "cn"- Returns:
- basename of an attribute
-
getBaseName
public static String getBaseName(String attrName)
Get base name for an attribute name. e.g, the base name of "cn;lang-en" or "cn;lang-ja" is "cn"- Returns:
- basename of the given attribute name
-
getValue
public String getValue()
Get one string value of the attribute- Returns:
- one value of the attribute
-
getStringValues
public String[] getStringValues()
Get the string values of the attribute- Returns:
- the values in an string array
-
contains
public boolean contains(String value)
Checks whether the given value already exist for the attribute- Parameters:
value- the value to check for- Returns:
trueif the value already exists,falseotherwise
-
getByteValue
public byte[] getByteValue()
Get one byte[] value of the attribute Returning a colletion would be better, but will not be consistent with the method getStringValues()- Returns:
- one byte[] value
-
getByteValues
public byte[][] getByteValues()
Get the byte[] values of the attribute- Returns:
- the byte[] values in array
-
contains
public boolean contains(byte[] value)
Checks whether the given value already exist for the attribute- Parameters:
value- the value to check for- Returns:
trueif the value already exists,falseotherwise
-
size
public int size()
Get the number of values of the attribute- Returns:
- The number of values of the attribute
-
clone
public Object clone()
Return a copy of the object
-
-