Package org.forgerock.opendj.ldap
Class AttributeDescription
java.lang.Object
org.forgerock.opendj.ldap.AttributeDescription
- All Implemented Interfaces:
Comparable<AttributeDescription>
An attribute description as defined in RFC 4512 section 2.5. Attribute
descriptions are used to identify an attribute in an entry and are composed
of an attribute type and a set of zero or more attribute options.
-
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(AttributeDescription other) Compares this attribute description to the provided attribute description.static AttributeDescriptioncreate(String attributeName, AttributeType attributeType) Creates an attribute description having the provided attribute name, type and no options.static AttributeDescriptioncreate(AttributeType attributeType) Creates an attribute description having the provided attribute type and no options.static AttributeDescriptioncreate(AttributeType attributeType, String option) Creates an attribute description having the provided attribute type and single option.static AttributeDescriptioncreate(AttributeType attributeType, String... options) Creates an attribute description having the provided attribute type and options.static AttributeDescriptioncreate(AttributeType attributeType, Collection<String> options) Creates an attribute description having the provided attribute type and options.booleanIndicates whether the provided object is an attribute description which is equal to this attribute description.Returns the attribute type associated with this attribute description.Returns anIterablecontaining the options contained in this attribute description.inthashCode()Returns the hash code for this attribute description.booleanIndicates whether this attribute description contains the provided option.booleanIndicates whether this attribute description has any options.booleanIndicates whether this attribute description is theobjectClassattribute description with no options.booleanIndicates whether this attribute description is a temporary place-holder allocated dynamically by a non-strict schema when no corresponding registered attribute type was found.booleanisSubTypeOf(AttributeDescription other) Indicates whether this attribute description is a sub-type of the provided attribute description as defined in RFC 4512 section 2.5.booleanIndicates whether this attribute description is a super-type of the provided attribute description as defined in RFC 4512 section 2.5.booleanmatches(AttributeDescription other) Indicates whether the provided attribute description matches this attribute description.static AttributeDescriptionmaxKey(AttributeType attributeType) Returns an attribute description having the provided attribute type and a set of options which sorts after any other set of options.static AttributeDescriptionReturns an attribute description representing the object class attribute type with no options.toString()Returns the string representation of this attribute description as defined in RFC4512 section 2.5.static AttributeDescriptionParses the provided LDAP string representation of an attribute description using the default schema.static AttributeDescriptionParses the provided LDAP string representation of an attribute description using the provided schema.withOption(String option) Returns an attribute description having the same attribute type and options as this attribute description as well as the provided option.withOptions(Iterable<String> options) Returns an attribute description having the same attribute type and options as this attribute description as well as the provided options.withOptions(String... options) Returns an attribute description having the same attribute type and options as this attribute description as well as the provided options.Returns an attribute description having the same attribute type as this attribute description except that all options has been removed.withoutOption(String option) Returns an attribute description having the same attribute type and options as this attribute description except for the provided option.
-
Method Details
-
withOption
Returns an attribute description having the same attribute type and options as this attribute description as well as the provided option.- Parameters:
option- The attribute option.- Returns:
- The new attribute description containing
option. - Throws:
NullPointerException- Ifoptionwasnull.
-
withOptions
Returns an attribute description having the same attribute type and options as this attribute description as well as the provided options.- Parameters:
options- The attribute options.- Returns:
- The new attribute description containing
options. - Throws:
NullPointerException- Ifoptionswasnull.
-
withOptions
Returns an attribute description having the same attribute type and options as this attribute description as well as the provided options.- Parameters:
options- The attribute options.- Returns:
- The new attribute description containing
options. - Throws:
NullPointerException- Ifoptionswasnull.
-
withoutOption
Returns an attribute description having the same attribute type and options as this attribute description except for the provided option.This method is idempotent: if this attribute description does not contain the provided option then this attribute description will be returned.
- Parameters:
option- The attribute option.- Returns:
- The new attribute description excluding
option. - Throws:
NullPointerException- Ifoptionwasnull.
-
withoutAnyOptions
Returns an attribute description having the same attribute type as this attribute description except that all options has been removed.This method is idempotent: if this attribute description does not contain option then this attribute description will be returned.
- Returns:
- The new attribute description excluding all
option. - Throws:
NullPointerException- IfattributeDescriptionoroptionwasnull.
-
create
Creates an attribute description having the provided attribute type and no options.- Parameters:
attributeType- The attribute type.- Returns:
- The attribute description.
- Throws:
NullPointerException- IfattributeTypewasnull.
-
create
Creates an attribute description having the provided attribute name, type and no options.- Parameters:
attributeName- The attribute name.attributeType- The attribute type.- Returns:
- The attribute description.
- Throws:
NullPointerException- IfattributeTypewasnull.
-
maxKey
Returns an attribute description having the provided attribute type and a set of options which sorts after any other set of options. This attribute description may be used in order to perform range queries on attribute description keyed collections such asSortedSets andSortedMaps. For example, the following code can be used to construct a range whose contents is all attributes having the same attribute type:SortedMap<AttributeDescription, Attribute> attributes = ...; AttributeType attributeType = ...; // Returns a map containing all attributes sharing the same attribute type. SortedMap<AttributeDescription, Attribute> subMap = attributes.subMap(attributeType.toAttributeDescription(), AttributeDescription.maxKey(attributeType));- Parameters:
attributeType- The attribute type.- Returns:
- An attribute description having the provided attribute type and a set of options which sorts after any other set of options.
- Throws:
NullPointerException- IfattributeTypewasnull.
-
create
Creates an attribute description having the provided attribute type and single option.- Parameters:
attributeType- The attribute type.option- The attribute option.- Returns:
- The attribute description.
- Throws:
NullPointerException- IfattributeTypeoroptionwasnull.
-
create
Creates an attribute description having the provided attribute type and options.- Parameters:
attributeType- The attribute type.options- The attribute options.- Returns:
- The attribute description.
- Throws:
NullPointerException- IfattributeTypeoroptionswasnull.
-
create
Creates an attribute description having the provided attribute type and options.- Parameters:
attributeType- The attribute type.options- The attribute options.- Returns:
- The attribute description.
- Throws:
NullPointerException- IfattributeTypeoroptionswasnull.
-
objectClass
Returns an attribute description representing the object class attribute type with no options.- Returns:
- The object class attribute description.
-
valueOf
Parses the provided LDAP string representation of an attribute description using the default schema.- Parameters:
attributeDescription- The LDAP string representation of an attribute description.- Returns:
- The parsed attribute description.
- Throws:
UnknownSchemaElementException- IfattributeDescriptioncontains an attribute type which is not contained in the default schema and the schema is strict.LocalizedIllegalArgumentException- IfattributeDescriptionis not a valid LDAP string representation of an attribute description.NullPointerException- IfattributeDescriptionwasnull.
-
valueOf
Parses the provided LDAP string representation of an attribute description using the provided schema.- Parameters:
attributeDescription- The LDAP string representation of an attribute description.schema- The schema to use when parsing the attribute description.- Returns:
- The parsed attribute description.
- Throws:
UnknownSchemaElementException- IfattributeDescriptioncontains an attribute type which is not contained in the provided schema and the schema is strict.LocalizedIllegalArgumentException- IfattributeDescriptionis not a valid LDAP string representation of an attribute description.NullPointerException- IfattributeDescriptionorschemawasnull.
-
compareTo
Compares this attribute description to the provided attribute description. The attribute types are compared first and then, if equal, the options are normalized, sorted, and compared.- Specified by:
compareToin interfaceComparable<AttributeDescription>- Parameters:
other- The attribute description to be compared.- Returns:
- A negative integer, zero, or a positive integer as this attribute description is less than, equal to, or greater than the specified attribute description.
- Throws:
NullPointerException- Ifnamewasnull.
-
hasOption
Indicates whether this attribute description contains the provided option.- Parameters:
option- The option for which to make the determination.- Returns:
trueif this attribute description has the provided option, orfalseif not.- Throws:
NullPointerException- Ifoptionwasnull.
-
equals
Indicates whether the provided object is an attribute description which is equal to this attribute description. It will be considered equal if the attribute types areequaland normalized sorted list of options are identical. -
getAttributeType
Returns the attribute type associated with this attribute description.- Returns:
- The attribute type associated with this attribute description.
-
getOptions
Returns anIterablecontaining the options contained in this attribute description. Attempts to remove options using an iterator'sremove()method are not permitted and will result in anUnsupportedOperationExceptionbeing thrown.- Returns:
- An
Iterablecontaining the options.
-
hashCode
public int hashCode()Returns the hash code for this attribute description. It will be calculated as the sum of the hash codes of the attribute type and normalized sorted list of options. -
hasOptions
public boolean hasOptions()Indicates whether this attribute description has any options.- Returns:
trueif this attribute description has any options, orfalseif not.
-
isObjectClass
public boolean isObjectClass()Indicates whether this attribute description is theobjectClassattribute description with no options.- Returns:
trueif this attribute description is theobjectClassattribute description with no options, orfalseif not.
-
isPlaceHolder
public boolean isPlaceHolder()Indicates whether this attribute description is a temporary place-holder allocated dynamically by a non-strict schema when no corresponding registered attribute type was found.Place holder attribute descriptions have an attribute type whose OID is the normalized attribute name with the string
-oidappended. In addition, they will use the directory string syntax and case ignore matching rule.- Returns:
trueif this is a temporary place-holder attribute description allocated dynamically by a non-strict schema when no corresponding registered attribute type was found.- See Also:
-
isSubTypeOf
Indicates whether this attribute description is a sub-type of the provided attribute description as defined in RFC 4512 section 2.5. Specifically, this method will returntrueif and only if the following conditions are bothtrue:- This attribute description has an attribute type which
matches, or is a sub-type of, the attribute type in the provided attribute description. - This attribute description contains all of the options contained in the provided attribute description.
trueif this attribute description is equal to the provided attribute description.- Parameters:
other- The attribute description for which to make the determination.- Returns:
trueif this attribute description is a sub-type of the provided attribute description, orfalseif not.- Throws:
NullPointerException- Ifnamewasnull.
- This attribute description has an attribute type which
-
isSuperTypeOf
Indicates whether this attribute description is a super-type of the provided attribute description as defined in RFC 4512 section 2.5. Specifically, this method will returntrueif and only if the following conditions are bothtrue:- This attribute description has an attribute type which
matches, or is a super-type of, the attribute type in the provided attribute description. - This attribute description contains a sub-set of the options contained in the provided attribute description.
trueif this attribute description is equal to the provided attribute description.- Parameters:
other- The attribute description for which to make the determination.- Returns:
trueif this attribute description is a super-type of the provided attribute description, orfalseif not.- Throws:
NullPointerException- Ifnamewasnull.
- This attribute description has an attribute type which
-
matches
Indicates whether the provided attribute description matches this attribute description. It will be considered a match if the attribute typesmatchand the normalized sorted list of options are identical.- Parameters:
other- The attribute description for which to make the determination.- Returns:
trueif the provided attribute description matches this attribute description, orfalseif not.
-
toString
Returns the string representation of this attribute description as defined in RFC4512 section 2.5.
-