org.opends.server.types
Class RawAttribute

java.lang.Object
  extended by org.opends.server.types.RawAttribute
Direct Known Subclasses:
LDAPAttribute

@PublicAPI(stability=UNCOMMITTED,
           mayInstantiate=true,
           mayExtend=false,
           mayInvoke=true)
public abstract class RawAttribute
extends java.lang.Object

This class defines a raw attribute, which has a type (which may include zero or more options), and zero or more values. It is an unprocessed element, so it will not have undergone any syntax or other forms of validity checking.


Constructor Summary
RawAttribute()
           
 
Method Summary
static RawAttribute create(Attribute attribute)
          Creates a new raw attribute from the provided attribute.
static RawAttribute create(java.lang.String attributeType)
          Creates a new raw attribute with the provided type and no values.
static RawAttribute create(java.lang.String attributeType, ByteString value)
          Creates a new raw attribute with the provided type value.
static RawAttribute create(java.lang.String attributeType, java.util.List<ByteString> values)
          Creates a new raw attribute with the provided type and values.
static RawAttribute create(java.lang.String attributeType, java.lang.String value)
          Creates a new raw attribute with the provided type value.
static LDAPAttribute decode(ASN1Element element)
          Decodes the provided ASN.1 element as an LDAP attribute.
 ASN1Element encode()
          Encodes this attribute to an ASN.1 element.
abstract  java.lang.String getAttributeType()
          Retrieves the attribute type for this attribute.
abstract  java.util.ArrayList<ASN1OctetString> getValues()
          Retrieves the set of values for this attribute.
abstract  void setAttributeType(java.lang.String attributeType)
          Specifies the attribute type for this attribute.
abstract  Attribute toAttribute()
          Retrieves a core attribute containing the information for this raw attribute.
 java.lang.String toString()
          Retrieves a string representation of this attribute.
abstract  void toString(java.lang.StringBuilder buffer)
          Appends a string representation of this attribute to the provided buffer.
abstract  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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RawAttribute

public RawAttribute()
Method Detail

create

public static RawAttribute create(java.lang.String attributeType)
Creates a new raw attribute with the provided type and no values.

Parameters:
attributeType - The attribute type for this attribute. It must not be null.
Returns:
The created raw attribute.

create

public static RawAttribute create(java.lang.String attributeType,
                                  java.lang.String value)
Creates a new raw attribute with the provided type value.

Parameters:
attributeType - The attribute type for this attribute. It must not be null.
value - The value to use for this attribute. It must not be null.
Returns:
The created raw attribute.

create

public static RawAttribute create(java.lang.String attributeType,
                                  ByteString value)
Creates a new raw attribute with the provided type value.

Parameters:
attributeType - The attribute type for this attribute. It must not be null.
value - The value to use for this attribute. It must not be null.
Returns:
The created raw attribute.

create

public static RawAttribute create(java.lang.String attributeType,
                                  java.util.List<ByteString> values)
Creates a new raw attribute with the provided type and values.

Parameters:
attributeType - The attribute type for this attribute. It must not be null.
values - The set of values for this attribute.
Returns:
The created raw attribute.

create

public static RawAttribute create(Attribute attribute)
Creates a new raw attribute from the provided attribute.

Parameters:
attribute - The attribute to use to create this raw attribute. It must not be null.
Returns:
The created raw attribute.

getAttributeType

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

Returns:
The attribute type for this attribute.

setAttributeType

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

Parameters:
attributeType - The attribute type for this attribute.

getValues

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

Returns:
The set of values for this attribute.

toAttribute

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

Returns:
A core attribute containing the information for this raw attribute.
Throws:
LDAPException - If the provided value is invalid according to the attribute syntax.

encode

public final ASN1Element encode()
Encodes this attribute to an ASN.1 element.

Returns:
The ASN.1 element containing the encoded attribute.

decode

public static LDAPAttribute decode(ASN1Element element)
                            throws LDAPException
Decodes the provided ASN.1 element as an LDAP attribute.

Parameters:
element - The ASN.1 element to decode.
Returns:
The decoded LDAP attribute.
Throws:
LDAPException - If a problem occurs while trying to decode the provided ASN.1 element as a raw attribute.

toString

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

Overrides:
toString in class java.lang.Object
Returns:
A string representation of this attribute.

toString

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

Parameters:
buffer - The buffer to which the information should be appended.

toString

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

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.