Class Ava
- All Implemented Interfaces:
Externalizable, Serializable, Cloneable, Comparable<Ava>
A Attribute Type And Value, which is the basis of all Rdn. It contains a type, and a value. The type must not be case sensitive. Superfluous leading and trailing spaces MUST have been trimmed before. The value MUST be in UTF8 format, according to RFC 2253. If the type is in OID form, then the value must be a hexadecimal string prefixed by a '#' character. Otherwise, the string must respect the RC 2253 grammar.
We will also keep a User Provided form of the AVA (Attribute Type And Value), called upName.
This class is immutable
- Author:
- Apache Directory Project
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAva()Constructs an empty AvaConstruct an Ava containing a binary value.Construct an Ava with a String value.Ava(SchemaManager schemaManager) Constructs an empty schema aware Ava.Ava(SchemaManager schemaManager, String upType, byte[] upValue) Construct a schema aware Ava containing a binary value.Ava(SchemaManager schemaManager, String upType, String upValue) Construct a schema aware Ava with a String value.Ava(SchemaManager schemaManager, String upType, String upName, byte[] upValue) Construct a schema aware Ava containing a binary value.Ava(SchemaManager schemaManager, String upType, String upName, String upValue) Construct a schema aware Ava with a String value.Ava(SchemaManager schemaManager, Ava ava) Constructs new Ava using the provided SchemaManager and AVA -
Method Summary
Modifier and TypeMethodDescriptionclone()Implements the cloning.intintdeserialize(byte[] buffer, int pos) Deserialize an AVA from a byte[], starting at a given positionbooleangetName()Get the user provided form of this attribute type and valueGet the normalized type of a AvagetType()Get the user provided type of a AvagetValue()Get the Value of a AvainthashCode()Gets the hashcode of this object.booleanTells if the Ava is schema aware or not.voidWe read back the data to create a new ATAV.intserialize(byte[] buffer, int pos) Serialize the AVA into a buffer at the given position.toString()A String representation of an Ava, as provided by the user.voidAn Ava is composed of a type and a value.
-
Constructor Details
-
Ava
public Ava()Constructs an empty Ava -
Ava
Constructs an empty schema aware Ava.- Parameters:
schemaManager- The SchemaManager instance
-
Ava
Constructs new Ava using the provided SchemaManager and AVA- Parameters:
schemaManager- The SchemaManager instanceava- The AVA to copy- Throws:
LdapInvalidDnException- If the Ava is invalid
-
Ava
Construct an Ava containing a binary value.Note that the upValue should not be null or empty, or resolve to an empty string after having trimmed it.
- Parameters:
upType- The User Provided typeupValue- The User Provided binary value- Throws:
LdapInvalidDnException- If the given type or value are invalid
-
Ava
public Ava(SchemaManager schemaManager, String upType, byte[] upValue) throws LdapInvalidDnException Construct a schema aware Ava containing a binary value. The AttributeType and value will be normalized accordingly to the given SchemaManager.Note that the upValue should not be null or empty, or resolve to an empty string after having trimmed it.
- Parameters:
schemaManager- The SchemaManager instanceupType- The User Provided typeupValue- The User Provided binary value- Throws:
LdapInvalidDnException- If the given type or value are invalid
-
Ava
public Ava(SchemaManager schemaManager, String upType, String upName, byte[] upValue) throws LdapInvalidDnException Construct a schema aware Ava containing a binary value. The AttributeType and value will be normalized accordingly to the given SchemaManager.Note that the upValue should not be null or empty, or resolve to an empty string after having trimmed it.
- Parameters:
schemaManager- The SchemaManager instanceupType- The User Provided typeupName- the User Provided AVAupValue- The User Provided binary value- Throws:
LdapInvalidDnException- If the given type or value are invalid
-
Ava
Construct an Ava with a String value.Note that the upValue should not be null or empty, or resolve to an empty string after having trimmed it.
- Parameters:
upType- The User Provided typeupValue- The User Provided String value- Throws:
LdapInvalidDnException- If the given type or value are invalid
-
Ava
public Ava(SchemaManager schemaManager, String upType, String upValue) throws LdapInvalidDnException Construct a schema aware Ava with a String value.Note that the upValue should not be null or empty, or resolve to an empty string after having trimmed it.
- Parameters:
schemaManager- The SchemaManager instanceupType- The User Provided typeupValue- The User Provided String value- Throws:
LdapInvalidDnException- If the given type or value are invalid
-
Ava
public Ava(SchemaManager schemaManager, String upType, String upName, String upValue) throws LdapInvalidDnException Construct a schema aware Ava with a String value.Note that the upValue should not be null or empty, or resolve to an empty string after having trimmed it.
- Parameters:
schemaManager- The SchemaManager instanceupType- The User Provided typeupName- the User provided AVAupValue- The User Provided String value- Throws:
LdapInvalidDnException- If the given type or value are invalid
-
-
Method Details
-
getNormType
-
getType
-
getValue
-
getName
Get the user provided form of this attribute type and value- Returns:
- The user provided form of this ava
-
getEscaped
- Returns:
- The Ava as an escaped String
-
clone
-
hashCode
-
equals
-
serialize
Serialize the AVA into a buffer at the given position.- Parameters:
buffer- The buffer which will contain the serialized Avapos- The position in the buffer for the serialized value- Returns:
- The new position in the buffer
- Throws:
IOException- Id the serialization failed
-
deserialize
public int deserialize(byte[] buffer, int pos) throws IOException, LdapInvalidAttributeValueException Deserialize an AVA from a byte[], starting at a given position- Parameters:
buffer- The buffer containing the AVApos- The position in the buffer- Returns:
- The new position
- Throws:
IOException- If the serialized value is not an AVALdapInvalidAttributeValueException- If the serialized AVA is invalid
-
writeExternal
An Ava is composed of a type and a value. The data are stored following the structure :- upName The User provided ATAV
- start The position of this ATAV in the Dn
- length The ATAV length
- upType The user Provided Type
- normType The normalized AttributeType
- isHR Tells if the value is a String or not
if the value is a String :- value The value
if the value is binary :- valueLength
- value The value
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException- If the Ava can't be written in the stream- See Also:
-
readExternal
We read back the data to create a new ATAV. The structure read is exposed in thewriteExternal(ObjectOutput)method- Specified by:
readExternalin interfaceExternalizable- Throws:
IOException- If the Ava can't b written to the streamClassNotFoundException- If we can't deserialize an Ava from the stream- See Also:
-
isSchemaAware
public boolean isSchemaAware()Tells if the Ava is schema aware or not.- Returns:
trueif the Ava is schema aware
-
getAttributeType
- Returns:
- the attributeType
-
compareTo
- Specified by:
compareToin interfaceComparable<Ava>- See Also:
-
toString
-