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
| Modifier and Type | Field and Description |
|---|---|
private AttributeType |
attributeType
The attributeType if the Ava is schemaAware
|
private int |
h
The computed hashcode
|
private static org.slf4j.Logger |
LOG
The LoggerFactory used by this class
|
private String |
normType
The normalized Name type
|
private SchemaManager |
schemaManager
the schema manager
|
private static long |
serialVersionUID
Declares the Serial Version Uid.
|
private String |
upName
The user provided Ava
|
private String |
upType
The user provided Name type
|
private Value |
value
The value.
|
| Constructor and Description |
|---|
Ava()
Constructs an empty Ava
|
Ava(AttributeType attributeType,
String upType,
String normType,
Value value,
String upName)
Construct an 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(SchemaManager schemaManager,
String upType,
String normType,
Value value)
Construct an Ava.
|
Ava(String upType,
byte[] upValue)
Construct an Ava containing a binary value.
|
Ava(String upType,
String upValue)
Construct an Ava with a String value.
|
Ava(String upType,
String normType,
Value value,
String upName)
Construct an Ava.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
apply(SchemaManager schemaManager)
Apply a SchemaManager to the Ava.
|
Ava |
clone()
Implements the cloning.
|
int |
compareTo(Ava that) |
private int |
compareValues(Ava that) |
private void |
createAva(SchemaManager schemaManager,
String upType,
Value value)
Construct a schema aware Ava.
|
private void |
createAva(String upType,
Value upValue)
Construct an Ava.
|
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.
|
private static final long serialVersionUID
private static final org.slf4j.Logger LOG
private String normType
private String upType
private Value value
private String upName
private AttributeType attributeType
private transient SchemaManager schemaManager
private volatile int h
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 invalidAva(String upType, String normType, Value value, String upName) throws LdapInvalidDnException
Note that the upValue should not be null or empty, or resolved to an empty string after having trimmed it.
upType - The User Provided typenormType - The normalized typevalue - The User Provided valueupName - The User Provided name (may be escaped)LdapInvalidDnException - If the given type or value are invalidAva(AttributeType attributeType, String upType, String normType, Value value, String upName) throws LdapInvalidDnException
Note that the upValue should not be null or empty, or resolved to an empty string after having trimmed it.
attributeType - The AttributeType for this valueupType - The User Provided typenormType - The normalized typevalue - The valueupName - The User Provided name (may be escaped)LdapInvalidDnException - If the given type or value are invalidAva(SchemaManager schemaManager, String upType, String normType, Value value) throws LdapInvalidDnException
Note that the upValue should not be null or empty, or resolved to an empty string after having trimmed it.
schemaManager - The SchemaManagerupType - The User Provided typenormType - The normalized typevalue - The valueLdapInvalidDnException - If the given type or value are invalidprivate void createAva(SchemaManager schemaManager, String upType, Value value)
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 typevalue - The valueprivate void createAva(String upType, Value upValue) throws LdapInvalidDnException
Note that the upValue should not be null or empty, or resolved to an empty string after having trimmed it.
upType - The User Provided typeupValue - The User Provided valueLdapInvalidDnException - If the given type or value are invalidprivate void apply(SchemaManager schemaManager) throws LdapInvalidDnException
schemaManager - The SchemaManager instance to useLdapInvalidDnException - If the Ava can't be normalized accordingly
to the given SchemaManagerpublic String getNormType()
public String getType()
public Value getValue()
public String getName()
public String getEscaped()
public Ava clone()
public int hashCode()
hashCode in class ObjectObject.hashCode()public boolean equals(Object obj)
equals in class ObjectObject.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 ExternalizableIOException - 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 ExternalizableIOException - 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()
private int compareValues(Ava that)
public int compareTo(Ava that)
compareTo in interface Comparable<Ava>Comparable.compareTo(Object)Copyright © 2003–2022 The Apache Software Foundation. All rights reserved.