public final class AttributeDescription extends Object implements Comparable<AttributeDescription>
Modifier and Type | Method and Description |
---|---|
int |
compareTo(AttributeDescription other)
Compares this attribute description to the provided attribute
description.
|
static AttributeDescription |
create(AttributeType attributeType)
Creates an attribute description having the provided attribute type and no options.
|
static AttributeDescription |
create(AttributeType attributeType,
Collection<String> options)
Creates an attribute description having the provided attribute type and options.
|
static AttributeDescription |
create(AttributeType attributeType,
String... options)
Creates an attribute description having the provided attribute type and options.
|
static AttributeDescription |
create(AttributeType attributeType,
String option)
Creates an attribute description having the provided attribute type and single option.
|
static AttributeDescription |
create(String attributeName,
AttributeType attributeType)
Creates an attribute description having the provided attribute name, type and no options.
|
boolean |
equals(Object o)
Indicates whether the provided object is an attribute description which
is equal to this attribute description.
|
AttributeType |
getAttributeType()
Returns the attribute type associated with this attribute description.
|
Iterable<String> |
getOptions()
Returns an
Iterable containing the options contained in this
attribute description. |
int |
hashCode()
Returns the hash code for this attribute description.
|
boolean |
hasOption(String option)
Indicates whether this attribute description contains the provided option.
|
boolean |
hasOptions()
Indicates whether this attribute description has any options.
|
boolean |
isObjectClass()
Indicates whether this attribute description is the
objectClass attribute description with no options. |
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.
|
boolean |
isSubTypeOf(AttributeDescription other)
Indicates whether this attribute description is a sub-type of the
provided attribute description as defined in RFC 4512 section 2.5.
|
boolean |
isSuperTypeOf(AttributeDescription other)
Indicates whether this attribute description is a super-type of
the provided attribute description as defined in RFC 4512 section 2.5.
|
boolean |
matches(AttributeDescription other)
Indicates whether the provided attribute description matches this
attribute description.
|
static AttributeDescription |
maxKey(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 AttributeDescription |
objectClass()
Returns an attribute description representing the object class attribute type with no options.
|
String |
toString()
Returns the string representation of this attribute description as
defined in RFC4512 section 2.5.
|
static AttributeDescription |
valueOf(String attributeDescription)
Parses the provided LDAP string representation of an attribute
description using the default schema.
|
static AttributeDescription |
valueOf(String attributeDescription,
Schema schema)
Parses the provided LDAP string representation of an attribute
description using the provided schema.
|
AttributeDescription |
withOption(String option)
Returns an attribute description having the same attribute type and
options as this attribute description as well as the provided option.
|
AttributeDescription |
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.
|
AttributeDescription |
withOptions(String... options)
Returns an attribute description having the same attribute type and options as this attribute description as well
as the provided options.
|
AttributeDescription |
withoutAnyOptions()
Returns an attribute description having the same attribute type as this attribute description
except that all options has been removed.
|
AttributeDescription |
withoutOption(String option)
Returns an attribute description having the same attribute type and options as this attribute description except
for the provided option.
|
public AttributeDescription withOption(String option)
option
- The attribute option.option
.NullPointerException
- If option
was null
.public AttributeDescription withOptions(Iterable<String> options)
options
- The attribute options.options
.NullPointerException
- If options
was null
.public AttributeDescription withOptions(String... options)
options
- The attribute options.options
.NullPointerException
- If options
was null
.public AttributeDescription withoutOption(String option)
This method is idempotent: if this attribute description does not contain the provided option then this attribute description will be returned.
option
- The attribute option.option
.NullPointerException
- If option
was null
.public AttributeDescription withoutAnyOptions()
This method is idempotent: if this attribute description does not contain option then this attribute description will be returned.
option
.NullPointerException
- If attributeDescription
or option
was
null
.public static AttributeDescription create(AttributeType attributeType)
attributeType
- The attribute type.NullPointerException
- If attributeType
was null
.public static AttributeDescription create(String attributeName, AttributeType attributeType)
attributeName
- The attribute name.attributeType
- The attribute type.NullPointerException
- If attributeType
was null
.public static AttributeDescription maxKey(AttributeType attributeType)
SortedSet
s and SortedMap
s. 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));
attributeType
- The attribute type.NullPointerException
- If attributeType
was null
.public static AttributeDescription create(AttributeType attributeType, String option)
attributeType
- The attribute type.option
- The attribute option.NullPointerException
- If attributeType
or option
was null
.public static AttributeDescription create(AttributeType attributeType, Collection<String> options)
attributeType
- The attribute type.options
- The attribute options.NullPointerException
- If attributeType
or options
was null
.public static AttributeDescription create(AttributeType attributeType, String... options)
attributeType
- The attribute type.options
- The attribute options.NullPointerException
- If attributeType
or options
was null
.public static AttributeDescription objectClass()
public static AttributeDescription valueOf(String attributeDescription)
attributeDescription
- The LDAP string representation of an attribute description.UnknownSchemaElementException
- If attributeDescription
contains an attribute type
which is not contained in the default schema and the schema
is strict.LocalizedIllegalArgumentException
- If attributeDescription
is not a valid LDAP string
representation of an attribute description.NullPointerException
- If attributeDescription
was null
.public static AttributeDescription valueOf(String attributeDescription, Schema schema)
attributeDescription
- The LDAP string representation of an attribute description.schema
- The schema to use when parsing the attribute description.UnknownSchemaElementException
- If attributeDescription
contains an attribute type
which is not contained in the provided schema and the schema
is strict.LocalizedIllegalArgumentException
- If attributeDescription
is not a valid LDAP string
representation of an attribute description.NullPointerException
- If attributeDescription
or schema
was
null
.public int compareTo(AttributeDescription other)
compareTo
in interface Comparable<AttributeDescription>
other
- The attribute description to be compared.NullPointerException
- If name
was null
.public boolean hasOption(String option)
option
- The option for which to make the determination.true
if this attribute description has the provided
option, or false
if not.NullPointerException
- If option
was null
.public boolean equals(Object o)
equal
and normalized
sorted list of options are identical.public AttributeType getAttributeType()
public Iterable<String> getOptions()
Iterable
containing the options contained in this
attribute description. Attempts to remove options using an iterator's
remove()
method are not permitted and will result in an
UnsupportedOperationException
being thrown.Iterable
containing the options.public int hashCode()
public boolean hasOptions()
true
if this attribute description has any options, or
false
if not.public boolean isObjectClass()
objectClass
attribute description with no options.true
if this attribute description is the
objectClass
attribute description with no options, or
false
if not.public boolean isPlaceHolder()
Place holder attribute descriptions have an attribute type whose OID is
the normalized attribute name with the string -oid
appended. In
addition, they will use the directory string syntax and case ignore
matching rule.
true
if this is a temporary place-holder attribute
description allocated dynamically by a non-strict schema when no
corresponding registered attribute type was found.Schema.getAttributeType(String)
,
AttributeType.isPlaceHolder()
public boolean isSubTypeOf(AttributeDescription other)
true
if and only if the
following conditions are both true
:
matches
, or is a sub-type of, the attribute
type in the provided attribute description.
true
if this attribute
description is equal to the provided attribute description.other
- The attribute description for which to make the determination.true
if this attribute description is a sub-type of the
provided attribute description, or false
if not.NullPointerException
- If name
was null
.public boolean isSuperTypeOf(AttributeDescription other)
true
if and only if the
following conditions are both true
:
matches
, or is a super-type of, the
attribute type in the provided attribute description.
true
if this attribute
description is equal to the provided attribute description.other
- The attribute description for which to make the determination.true
if this attribute description is a super-type of the
provided attribute description, or false
if not.NullPointerException
- If name
was null
.public boolean matches(AttributeDescription other)
match
and the normalized sorted list
of options are identical.other
- The attribute description for which to make the determination.true
if the provided attribute description matches this
attribute description, or false
if not.Copyright 2010-2022 ForgeRock AS.