org.opends.server.protocols.ldap
Class LDAPAttribute

java.lang.Object
  extended by org.opends.server.types.RawAttribute
      extended by org.opends.server.protocols.ldap.LDAPAttribute

public class LDAPAttribute
extends RawAttribute

This class defines the data structures and methods to use when interacting with an LDAP attribute, which is the basic unit of information in an LDAP entry.


Constructor Summary
LDAPAttribute(Attribute attribute)
          Creates a new LDAP attribute from the provided attribute.
LDAPAttribute(java.lang.String attributeType)
          Creates a new LDAP attribute with the provided type and no values.
LDAPAttribute(java.lang.String attributeType, java.util.ArrayList<ASN1OctetString> values)
          Creates a new LDAP attribute with the provided type and values.
LDAPAttribute(java.lang.String attributeType, ASN1OctetString value)
          Creates a new LDAP attribute with the provided type and no values.
LDAPAttribute(java.lang.String attributeType, java.util.List<java.lang.String> values)
          Creates a new LDAP attribute with the provided type and values.
LDAPAttribute(java.lang.String attributeType, java.lang.String value)
          Creates a new LDAP attribute with the provided type and no values.
 
Method Summary
 java.lang.String getAttributeType()
          Retrieves the attribute type for this attribute.
 java.util.ArrayList<ASN1OctetString> getValues()
          Retrieves the set of values for this attribute.
 void setAttributeType(java.lang.String attributeType)
          Specifies the attribute type for this attribute.
 Attribute toAttribute()
          Retrieves a core attribute containing the information for this LDAP attribute.
 java.lang.String toString()
          Retrieves a string representation of this attribute.
 void toString(java.lang.StringBuilder buffer)
          Appends a string representation of this attribute to the provided buffer.
 void toString(java.lang.StringBuilder buffer, int indent)
          Appends a multi-line string representation of this LDAP attribute to the provided buffer.
 
Methods inherited from class org.opends.server.types.RawAttribute
create, create, create, create, create, decode, encode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LDAPAttribute

public LDAPAttribute(java.lang.String attributeType)
Creates a new LDAP attribute with the provided type and no values.

Parameters:
attributeType - The attribute type for this attribute.

LDAPAttribute

public LDAPAttribute(java.lang.String attributeType,
                     java.lang.String value)
Creates a new LDAP attribute with the provided type and no values.

Parameters:
attributeType - The attribute type for this attribute.
value - The value to use for this attribute.

LDAPAttribute

public LDAPAttribute(java.lang.String attributeType,
                     ASN1OctetString value)
Creates a new LDAP attribute with the provided type and no values.

Parameters:
attributeType - The attribute type for this attribute.
value - The value to use for this attribute.

LDAPAttribute

public LDAPAttribute(java.lang.String attributeType,
                     java.util.List<java.lang.String> values)
Creates a new LDAP attribute with the provided type and values.

Parameters:
attributeType - The attribute type for this attribute.
values - The set of values for this attribute.

LDAPAttribute

public LDAPAttribute(java.lang.String attributeType,
                     java.util.ArrayList<ASN1OctetString> values)
Creates a new LDAP attribute with the provided type and values.

Parameters:
attributeType - The attribute type for this attribute.
values - The set of values for this attribute.

LDAPAttribute

public LDAPAttribute(Attribute attribute)
Creates a new LDAP attribute from the provided attribute.

Parameters:
attribute - The attribute to use to create this LDAP attribute.
Method Detail

getAttributeType

public java.lang.String getAttributeType()
Retrieves the attribute type for this attribute.

Specified by:
getAttributeType in class RawAttribute
Returns:
The attribute type for this attribute.

setAttributeType

public void setAttributeType(java.lang.String attributeType)
Specifies the attribute type for this attribute.

Specified by:
setAttributeType in class RawAttribute
Parameters:
attributeType - The attribute type for this attribute.

getValues

public java.util.ArrayList<ASN1OctetString> getValues()
Retrieves the set of values for this attribute. The returned list may be modified by the caller.

Specified by:
getValues in class RawAttribute
Returns:
The set of values for this attribute.

toAttribute

public Attribute toAttribute()
                      throws LDAPException
Retrieves a core attribute containing the information for this LDAP attribute.

Specified by:
toAttribute in class RawAttribute
Returns:
A core attribute containing the information for this LDAP attribute.
Throws:
LDAPException - If the provided value is invalid according to the attribute syntax.

toString

public java.lang.String toString()
Retrieves a string representation of this attribute.

Overrides:
toString in class RawAttribute
Returns:
A string representation of this attribute.

toString

public void toString(java.lang.StringBuilder buffer)
Appends a string representation of this attribute to the provided buffer.

Specified by:
toString in class RawAttribute
Parameters:
buffer - The buffer to which the information should be appended.

toString

public void toString(java.lang.StringBuilder buffer,
                     int indent)
Appends a multi-line string representation of this LDAP attribute to the provided buffer.

Specified by:
toString in class RawAttribute
Parameters:
buffer - The buffer to which the information should be appended.
indent - The number of spaces from the margin that the lines should be indented.