Class AVA

java.lang.Object
org.forgerock.opendj.ldap.AVA
All Implemented Interfaces:
Comparable<AVA>

public final class AVA extends Object implements Comparable<AVA>
An attribute value assertion (AVA) as defined in RFC 4512 section 2.3 consists of an attribute description with zero options and an attribute value.

The following are examples of string representations of AVAs:

 uid=12345
 ou=Engineering
 cn=Kurt Zeilenga
 
Note: The name AVA is historical, coming from X500/LDAPv2. However, in LDAP context, this class actually represents an AttributeTypeAndValue.
See Also:
  • Constructor Details

    • AVA

      public AVA(AttributeType attributeType, Object attributeValue)
      Creates a new attribute value assertion (AVA) using the provided attribute type and value.

      If attributeValue is not an instance of ByteString then it will be converted using the ByteString.valueOfObject(Object) method.

      Parameters:
      attributeType - The attribute type.
      attributeValue - The attribute value.
      Throws:
      NullPointerException - If attributeType or attributeValue was null.
    • AVA

      public AVA(AttributeType attributeType, String attributeName, Object attributeValue)
      Creates a new attribute value assertion (AVA) using the provided attribute type, name and value.

      If attributeValue is not an instance of ByteString then it will be converted using the ByteString.valueOfObject(Object) method.

      Parameters:
      attributeType - The attribute type.
      attributeName - The user provided attribute name.
      attributeValue - The attribute value.
      Throws:
      NullPointerException - If attributeType, attributeName or attributeValue was null.
    • AVA

      public AVA(String attributeType, Object attributeValue)
      Creates a new attribute value assertion (AVA) using the provided attribute type and value decoded using the default schema.

      If attributeValue is not an instance of ByteString then it will be converted using the ByteString.valueOfObject(Object) method.

      Parameters:
      attributeType - The attribute type.
      attributeValue - The attribute value.
      Throws:
      UnknownSchemaElementException - If attributeType was not found in the default schema.
      NullPointerException - If attributeType or attributeValue was null.
  • Method Details

    • valueOf

      public static AVA valueOf(String ava)
      Parses the provided LDAP string representation of an AVA using the default schema.
      Parameters:
      ava - The LDAP string representation of an AVA.
      Returns:
      The parsed RDN.
      Throws:
      org.forgerock.i18n.LocalizedIllegalArgumentException - If ava is not a valid LDAP string representation of a AVA.
      NullPointerException - If ava was null.
    • valueOf

      public static AVA valueOf(String ava, Schema schema)
      Parses the provided LDAP string representation of an AVA using the provided schema.
      Parameters:
      ava - The LDAP string representation of a AVA.
      schema - The schema to use when parsing the AVA.
      Returns:
      The parsed AVA.
      Throws:
      org.forgerock.i18n.LocalizedIllegalArgumentException - If ava is not a valid LDAP string representation of a AVA.
      NullPointerException - If ava or schema was null.
    • compareTo

      public int compareTo(AVA ava)
      Specified by:
      compareTo in interface Comparable<AVA>
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getAttributeType

      Returns the attribute type associated with this AVA.
      Returns:
      The attribute type associated with this AVA.
    • getAttributeName

      Returns the attribute name associated with this AVA.
      Returns:
      The attribute name associated with this AVA.
    • getAttributeValue

      Returns the attribute value associated with this AVA.
      Returns:
      The attribute value associated with this AVA.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toAttribute

      Returns a single valued attribute having the same attribute type and value as this AVA.
      Returns:
      A single valued attribute having the same attribute type and value as this AVA.
    • toString

      public String toString()
      Overrides:
      toString in class Object