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 anAttributeTypeAndValue
.
-
-
Constructor Summary
Constructors Constructor Description Ava(String attributeType, Object attributeValue)
Creates a new attribute value assertion (AVA) using the provided attribute type and value decoded using the default schema.Ava(AttributeType attributeType, Object attributeValue)
Creates a new attribute value assertion (AVA) using the provided attribute type and value.Ava(AttributeType attributeType, String attributeName, Object attributeValue)
Creates a new attribute value assertion (AVA) using the provided attribute type, name and value.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Ava ava)
boolean
equals(Object obj)
String
getAttributeName()
Returns the attribute name associated with this AVA.AttributeType
getAttributeType()
Returns the attribute type associated with this AVA.ByteString
getAttributeValue()
Returns the attribute value associated with this AVA.int
hashCode()
Attribute
toAttribute()
Returns a single valued attribute having the same attribute type and value as this AVA.String
toString()
Returns the RFC 4514 string representation of this AVA.static Ava
valueOf(String ava)
Parses the provided LDAP string representation of an AVA using the default schema.static Ava
valueOf(String ava, Schema schema)
Parses the provided LDAP string representation of an AVA using the provided schema.
-
-
-
Constructor Detail
-
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 ofByteString
then it will be converted using theByteString.valueOfObject(Object)
method.- Parameters:
attributeType
- The attribute type.attributeValue
- The attribute value.- Throws:
NullPointerException
- IfattributeType
orattributeValue
wasnull
.
-
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 ofByteString
then it will be converted using theByteString.valueOfObject(Object)
method.- Parameters:
attributeType
- The attribute type.attributeValue
- The attribute value.- Throws:
UnknownSchemaElementException
- IfattributeType
was not found in the default schema.NullPointerException
- IfattributeType
orattributeValue
wasnull
.
-
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 ofByteString
then it will be converted using theByteString.valueOfObject(Object)
method.- Parameters:
attributeType
- The attribute type.attributeName
- The user provided attribute name.attributeValue
- The attribute value.- Throws:
NullPointerException
- IfattributeType
,attributeName
orattributeValue
wasnull
.
-
-
Method Detail
-
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:
LocalizedIllegalArgumentException
- Ifava
is not a valid LDAP string representation of a AVA.NullPointerException
- Ifava
wasnull
.
-
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:
LocalizedIllegalArgumentException
- Ifava
is not a valid LDAP string representation of a AVA.NullPointerException
- Ifava
orschema
wasnull
.
-
compareTo
public int compareTo(Ava ava)
- Specified by:
compareTo
in interfaceComparable<Ava>
-
getAttributeType
public AttributeType getAttributeType()
Returns the attribute type associated with this AVA.- Returns:
- The attribute type associated with this AVA.
-
getAttributeName
public String getAttributeName()
Returns the attribute name associated with this AVA.- Returns:
- The attribute name associated with this AVA.
-
getAttributeValue
public ByteString getAttributeValue()
Returns the attribute value associated with this AVA.- Returns:
- The attribute value associated with this AVA.
-
toAttribute
public Attribute 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()
Returns the RFC 4514 string representation of this AVA. If this AVA was constructed using a call tovalueOf(String)
, then this method will return the original user-provided string representation cleaned such that any illegal white-space characters are removed.The attribute value will be encoded as ASN.1 BER when the attribute name is a numeric OID or when the attribute syntax is known and it is not human-readable. This method will only perform a best-effort ASN.1 encoding by assuming that the attribute is an ASN.1 OctetString. The assumption is that client code will not use a numeric OID in order to deliberately obfuscate human-readable attribute values.
- Overrides:
toString
in classObject
- Returns:
- The RFC 4514 string representation of this AVA.
- See Also:
- RFC 4514 - Lightweight Directory Access Protocol (LDAP): String Representation of Distinguished Names
-
-