public class Ava extends Object implements Externalizable, 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
Constructor and Description |
---|
Ava()
Constructs an empty Ava
|
Ava(SchemaManager schemaManager)
Constructs an empty schema aware Ava.
|
Ava(SchemaManager schemaManager,
Ava ava)
Constructs new Ava using the provided SchemaManager and 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(String upType,
byte[] upValue)
Construct an Ava containing a binary value.
|
Ava(String upType,
String upValue)
Construct an Ava with a String value.
|
Modifier and Type | Method and Description |
---|---|
Ava |
clone()
Implements the cloning.
|
int |
compareTo(Ava that) |
int |
deserialize(byte[] buffer,
int pos)
Deserialize an AVA from a byte[], starting at a given position
|
boolean |
equals(Object obj) |
AttributeType |
getAttributeType() |
String |
getEscaped() |
String |
getName()
Get the user provided form of this attribute type and value
|
String |
getNormType()
Get the normalized type of a Ava
|
String |
getType()
Get the user provided type of a Ava
|
Value |
getValue()
Get the Value of a Ava
|
int |
hashCode()
Gets the hashcode of this object.
|
boolean |
isSchemaAware()
Tells if the Ava is schema aware or not.
|
void |
readExternal(ObjectInput in)
We read back the data to create a new ATAV.
|
int |
serialize(byte[] buffer,
int pos)
Serialize the AVA into a buffer at the given position.
|
String |
toString()
A String representation of an Ava, as provided by the user.
|
void |
writeExternal(ObjectOutput out)
An Ava is composed of a type and a value.
|
public Ava()
public Ava(SchemaManager schemaManager)
schemaManager
- The SchemaManager instancepublic Ava(SchemaManager schemaManager, Ava ava) throws LdapInvalidDnException
schemaManager
- The SchemaManager instanceava
- The AVA to copyLdapInvalidDnException
- If the Ava is invalidpublic Ava(String upType, byte[] upValue) throws LdapInvalidDnException
Note that the upValue should not be null or empty, or resolve to an empty string after having trimmed it.
upType
- The User Provided typeupValue
- The User Provided binary valueLdapInvalidDnException
- If the given type or value are invalidpublic Ava(SchemaManager schemaManager, String upType, byte[] upValue) throws LdapInvalidDnException
Note that the upValue should not be null or empty, or resolve to an empty string after having trimmed it.
schemaManager
- The SchemaManager instanceupType
- The User Provided typeupValue
- The User Provided binary valueLdapInvalidDnException
- If the given type or value are invalidpublic Ava(SchemaManager schemaManager, String upType, String upName, byte[] upValue) throws LdapInvalidDnException
Note that the upValue should not be null or empty, or resolve to an empty string after having trimmed it.
schemaManager
- The SchemaManager instanceupType
- The User Provided typeupName
- the User Provided AVAupValue
- The User Provided binary valueLdapInvalidDnException
- If the given type or value are invalidpublic Ava(String upType, String upValue) throws LdapInvalidDnException
Note that the upValue should not be null or empty, or resolve to an empty string after having trimmed it.
upType
- The User Provided typeupValue
- The User Provided String valueLdapInvalidDnException
- If the given type or value are invalidpublic Ava(SchemaManager schemaManager, String upType, String upValue) throws LdapInvalidDnException
Note that the upValue should not be null or empty, or resolve to an empty string after having trimmed it.
schemaManager
- The SchemaManager instanceupType
- The User Provided typeupValue
- The User Provided String valueLdapInvalidDnException
- If the given type or value are invalidpublic Ava(SchemaManager schemaManager, String upType, String upName, String upValue) throws LdapInvalidDnException
Note that the upValue should not be null or empty, or resolve to an empty string after having trimmed it.
schemaManager
- The SchemaManager instanceupType
- The User Provided typeupName
- the User provided AVAupValue
- The User Provided String valueLdapInvalidDnException
- If the given type or value are invalidpublic String getNormType()
public String getName()
public String getEscaped()
public int hashCode()
hashCode
in class Object
Object.hashCode()
public boolean equals(Object obj)
equals
in class Object
Object.equals(Object)
public int serialize(byte[] buffer, int pos) throws IOException
buffer
- The buffer which will contain the serialized Avapos
- The position in the buffer for the serialized valueIOException
- Id the serialization failedpublic int deserialize(byte[] buffer, int pos) throws IOException, LdapInvalidAttributeValueException
buffer
- The buffer containing the AVApos
- The position in the bufferIOException
- If the serialized value is not an AVALdapInvalidAttributeValueException
- If the serialized AVA is invalidpublic void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
- If the Ava can't be written in the streamExternalizable.readExternal(ObjectInput)
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
writeExternal(ObjectOutput)
methodreadExternal
in interface Externalizable
IOException
- If the Ava can't b written to the streamClassNotFoundException
- If we can't deserialize an Ava from the streamExternalizable.readExternal(ObjectInput)
public boolean isSchemaAware()
public AttributeType getAttributeType()
public int compareTo(Ava that)
compareTo
in interface Comparable<Ava>
Comparable.compareTo(Object)
Copyright © 2003–2020 The Apache Software Foundation. All rights reserved.