public interface Entry
Some methods require a schema in order to decode their parameters (e.g.
addAttribute(String, Object...)
and setName(String)
). In
these cases the default schema is used unless an alternative schema is
specified in the Entry
constructor. The default schema is not used
for any other purpose. In particular, an Entry
may contain attributes
which have been decoded using different schemas.
When determining whether an entry already contains a particular attribute,
attribute descriptions will be compared using
AttributeDescription.matches(org.forgerock.opendj.ldap.AttributeDescription)
.
Full LDAP modify semantics are provided via the addAttribute(org.forgerock.opendj.ldap.Attribute)
,
removeAttribute(org.forgerock.opendj.ldap.Attribute, java.util.Collection<? super org.forgerock.opendj.ldap.ByteString>)
, and replaceAttribute(org.forgerock.opendj.ldap.Attribute)
methods.
Implementations should specify any constraints or special behavior. Specifically:
getAllAttributes()
method.
addAttribute(org.forgerock.opendj.ldap.Attribute)
, removeAttribute(org.forgerock.opendj.ldap.Attribute, java.util.Collection<? super org.forgerock.opendj.ldap.ByteString>)
, and
replaceAttribute(org.forgerock.opendj.ldap.Attribute)
and the conditions, if any, where a reference to
the passed in attribute is maintained.
Entries
Modifier and Type | Method and Description |
---|---|
boolean |
addAttribute(Attribute attribute)
Ensures that this entry contains the provided attribute and values
(optional operation).
|
boolean |
addAttribute(Attribute attribute,
Collection<? super ByteString> duplicateValues)
Ensures that this entry contains the provided attribute and values
(optional operation).
|
Entry |
addAttribute(String attributeDescription,
Object... values)
Ensures that this entry contains the provided attribute and values
(optional operation).
|
Entry |
clearAttributes()
Removes all the attributes from this entry (optional operation).
|
boolean |
containsAttribute(Attribute attribute,
Collection<? super ByteString> missingValues)
Returns
true if this entry contains all of the attribute values
contained in attribute . |
boolean |
containsAttribute(String attributeDescription,
Object... values)
Returns
true if this entry contains all of the attribute values
contained in values . |
boolean |
equals(Object object)
Returns
true if object is an entry which is equal to this
entry. |
Iterable<Attribute> |
getAllAttributes()
Returns an
Iterable containing all of the attributes in this
entry. |
Iterable<Attribute> |
getAllAttributes(AttributeDescription attributeDescription)
Returns an
Iterable containing all the attributes in this entry
having an attribute description which is a sub-type of the provided
attribute description. |
Iterable<Attribute> |
getAllAttributes(String attributeDescription)
Returns an
Iterable containing all the attributes in this entry
having an attribute description which is a sub-type of the provided
attribute description. |
Attribute |
getAttribute(AttributeDescription attributeDescription)
Returns the named attribute contained in this entry, or
null if
it is not included with this entry. |
Attribute |
getAttribute(String attributeDescription)
Returns the named attribute contained in this entry, or
null if
it is not included with this entry. |
int |
getAttributeCount()
Returns the number of attributes in this entry.
|
DN |
getName()
Returns the string representation of the distinguished name of this
entry.
|
int |
hashCode()
Returns the hash code for this entry.
|
AttributeParser |
parseAttribute(AttributeDescription attributeDescription)
Returns a parser for the named attribute contained in this entry.
|
AttributeParser |
parseAttribute(String attributeDescription)
Returns a parser for the named attribute contained in this entry.
|
boolean |
removeAttribute(Attribute attribute,
Collection<? super ByteString> missingValues)
Removes all of the attribute values contained in
attribute from
this entry if it is present (optional operation). |
boolean |
removeAttribute(AttributeDescription attributeDescription)
Removes the named attribute from this entry if it is present (optional
operation).
|
Entry |
removeAttribute(String attributeDescription,
Object... values)
Removes all of the attribute values contained in
values from the
named attribute in this entry if it is present (optional operation). |
boolean |
replaceAttribute(Attribute attribute)
Adds all of the attribute values contained in
attribute to this
entry, replacing any existing attribute values (optional operation). |
Entry |
replaceAttribute(String attributeDescription,
Object... values)
Adds all of the attribute values contained in
values to this
entry, replacing any existing attribute values (optional operation). |
Entry |
setName(DN dn)
Sets the distinguished name of this entry (optional operation).
|
Entry |
setName(String dn)
Sets the distinguished name of this entry (optional operation).
|
String |
toString()
Returns a string representation of this entry.
|
boolean addAttribute(Attribute attribute)
matching
attribute description, then
this entry will be modified such that it contains attribute
, even
if it is empty.
matching
attribute description, then
the attribute values contained in attribute
will be merged with
the existing attribute values.
NOTE: When attribute
is non-empty, this method implements
LDAP Modify add semantics.
attribute
- The attribute values to be added to this entry, merging with
any existing attribute values.true
if this entry changed as a result of this call.UnsupportedOperationException
- If this entry does not permit attributes or their values to
be added.NullPointerException
- If attribute
was null
.boolean addAttribute(Attribute attribute, Collection<? super ByteString> duplicateValues)
matching
attribute description, then
this entry will be modified such that it contains attribute
, even
if it is empty.
matching
attribute description, then
the attribute values contained in attribute
will be merged with
the existing attribute values.
NOTE: When attribute
is non-empty, this method implements
LDAP Modify add semantics.
attribute
- The attribute values to be added to this entry, merging with
any existing attribute values.duplicateValues
- A collection into which duplicate values will be added, or
null
if duplicate values should not be saved.true
if this entry changed as a result of this call.UnsupportedOperationException
- If this entry does not permit attributes or their values to
be added.NullPointerException
- If attribute
was null
.Entry addAttribute(String attributeDescription, Object... values)
matching
attribute description, then
this entry will be modified such that it contains attribute
, even
if it is empty.
matching
attribute description, then
the attribute values contained in attribute
will be merged with
the existing attribute values.
The attribute description will be decoded using the schema associated with this entry (usually the default schema).
Any attribute values which are not instances of ByteString
will
be converted using the ByteString.valueOfObject(Object)
method.
NOTE: When attribute
is non-empty, this method implements
LDAP Modify add semantics.
attributeDescription
- The name of the attribute whose values are to be added.values
- The attribute values to be added to this entry, merging any
existing attribute values.LocalizedIllegalArgumentException
- If attributeDescription
could not be decoded using
the schema associated with this entry.UnsupportedOperationException
- If this entry does not permit attributes or their values to
be added.NullPointerException
- If attributeDescription
was null
.Entry clearAttributes()
UnsupportedOperationException
- If this entry does not permit attributes to be removed.boolean containsAttribute(Attribute attribute, Collection<? super ByteString> missingValues)
true
if this entry contains all of the attribute values
contained in attribute
. If attribute
is empty then this
method will return true
if the attribute is present in this
entry, regardless of how many values it contains.attribute
- The attribute values whose presence in this entry is to be
tested.missingValues
- A collection into which missing values will be added, or
null
if missing values should not be saved.true
if this entry contains all of the attribute values
contained in attribute
.NullPointerException
- If attribute
was null
.boolean containsAttribute(String attributeDescription, Object... values)
true
if this entry contains all of the attribute values
contained in values
. If values
is null
or empty
then this method will return true
if the attribute is present in
this entry, regardless of how many values it contains.
The attribute description will be decoded using the schema associated with this entry (usually the default schema).
Any attribute values which are not instances of ByteString
will
be converted using the ByteString.valueOfObject(Object)
method.
attributeDescription
- The name of the attribute whose presence in this entry is to
be tested.values
- The attribute values whose presence in this entry is to be
tested, which may be null
.true
if this entry contains all of the attribute values
contained in values
.LocalizedIllegalArgumentException
- If attributeDescription
could not be decoded using
the schema associated with this entry.NullPointerException
- If attributeDescription
was null
.boolean equals(Object object)
true
if object
is an entry which is equal to this
entry. Two entries are considered equal if their distinguished names are
equal, they both have the same number of attributes, and every attribute
contained in the first entry is also contained in the second entry.Iterable<Attribute> getAllAttributes()
Iterable
containing all of the attributes in this
entry. The returned Iterable
may be used to remove attributes if
permitted by this entry.Iterable
containing all of the attributes.Iterable<Attribute> getAllAttributes(AttributeDescription attributeDescription)
Iterable
containing all the attributes in this entry
having an attribute description which is a sub-type of the provided
attribute description. The returned Iterable
may be used to
remove attributes if permitted by this entry.attributeDescription
- The name of the attributes to be returned.Iterable
containing the matching attributes.NullPointerException
- If attributeDescription
was null
.Iterable<Attribute> getAllAttributes(String attributeDescription)
Iterable
containing all the attributes in this entry
having an attribute description which is a sub-type of the provided
attribute description. The returned Iterable
may be used to
remove attributes if permitted by this entry.
The attribute description will be decoded using the schema associated with this entry (usually the default schema).
attributeDescription
- The name of the attributes to be returned.Iterable
containing the matching attributes.LocalizedIllegalArgumentException
- If attributeDescription
could not be decoded using
the schema associated with this entry.NullPointerException
- If attributeDescription
was null
.Attribute getAttribute(AttributeDescription attributeDescription)
null
if
it is not included with this entry.attributeDescription
- The name of the attribute to be returned.null
if it is not included with
this entry.NullPointerException
- If attributeDescription
was null
.Attribute getAttribute(String attributeDescription)
null
if
it is not included with this entry.
The attribute description will be decoded using the schema associated with this entry (usually the default schema).
attributeDescription
- The name of the attribute to be returned.null
if it is not included with
this entry.LocalizedIllegalArgumentException
- If attributeDescription
could not be decoded using
the schema associated with this entry.NullPointerException
- If attributeDescription
was null
.int getAttributeCount()
DN getName()
int hashCode()
AttributeParser parseAttribute(AttributeDescription attributeDescription)
attributeDescription
- The name of the attribute to be parsed.NullPointerException
- If attributeDescription
was null
.AttributeParser parseAttribute(String attributeDescription)
The attribute description will be decoded using the schema associated with this entry (usually the default schema).
attributeDescription
- The name of the attribute to be parsed.LocalizedIllegalArgumentException
- If attributeDescription
could not be decoded using
the schema associated with this entry.NullPointerException
- If attributeDescription
was null
.boolean removeAttribute(Attribute attribute, Collection<? super ByteString> missingValues)
attribute
from
this entry if it is present (optional operation). If attribute
is
empty then the entire attribute will be removed if it is present.
NOTE: This method implements LDAP Modify delete semantics.
attribute
- The attribute values to be removed from this entry, which may
be empty if the entire attribute is to be removed.missingValues
- A collection into which missing values will be added, or
null
if missing values should not be saved.true
if this entry changed as a result of this call.UnsupportedOperationException
- If this entry does not permit attributes or their values to
be removed.NullPointerException
- If attribute
was null
.boolean removeAttribute(AttributeDescription attributeDescription)
false
.attributeDescription
- The name of the attribute to be removed.true
if this entry changed as a result of this call.UnsupportedOperationException
- If this entry does not permit attributes to be removed.NullPointerException
- If attributeDescription
was null
.Entry removeAttribute(String attributeDescription, Object... values)
values
from the
named attribute in this entry if it is present (optional operation). If
values
is null
or empty then the entire attribute will be
removed if it is present.
The attribute description will be decoded using the schema associated with this entry (usually the default schema).
Any attribute values which are not instances of ByteString
will
be converted using the ByteString.valueOfObject(Object)
method.
NOTE: This method implements LDAP Modify delete semantics.
attributeDescription
- The name of the attribute whose values are to be removed.values
- The attribute values to be removed from this entry, which may
be null
or empty if the entire attribute is to be
removed.LocalizedIllegalArgumentException
- If attributeDescription
could not be decoded using
the schema associated with this entry.UnsupportedOperationException
- If this entry does not permit attributes or their values to
be removed.NullPointerException
- If attributeDescription
was null
.boolean replaceAttribute(Attribute attribute)
attribute
to this
entry, replacing any existing attribute values (optional operation). If
attribute
is empty then the entire attribute will be removed if
it is present.
NOTE: This method implements LDAP Modify replace semantics as described in RFC 4511 - Section 4.6. Modify Operation.
attribute
- The attribute values to be added to this entry, replacing any
existing attribute values, and which may be empty if the
entire attribute is to be removed.true
if this entry changed as a result of this call.UnsupportedOperationException
- If this entry does not permit attributes or their values to
be replaced.NullPointerException
- If attribute
was null
.Entry replaceAttribute(String attributeDescription, Object... values)
values
to this
entry, replacing any existing attribute values (optional operation). If
values
is null
or empty then the entire attribute will be
removed if it is present.
The attribute description will be decoded using the schema associated with this entry (usually the default schema).
Any attribute values which are not instances of ByteString
will
be converted using the ByteString.valueOfObject(Object)
method.
NOTE: This method implements LDAP Modify replace semantics as described in RFC 4511 - Section 4.6. Modify Operation.
attributeDescription
- The name of the attribute whose values are to be replaced.values
- The attribute values to be added to this entry, replacing any
existing attribute values, and which may be null
or
empty if the entire attribute is to be removed.LocalizedIllegalArgumentException
- If attributeDescription
could not be decoded using
the schema associated with this entry.UnsupportedOperationException
- If this entry does not permit attributes or their values to
be replaced.NullPointerException
- If attribute
was null
.Entry setName(DN dn)
dn
- The distinguished name.UnsupportedOperationException
- If this entry does not permit the distinguished name to be
set.NullPointerException
- If dn
was null
.Entry setName(String dn)
The distinguished name will be decoded using the schema associated with this entry (usually the default schema).
dn
- The string representation of the distinguished name.LocalizedIllegalArgumentException
- If dn
could not be decoded using the schema
associated with this entry.UnsupportedOperationException
- If this entry does not permit the distinguished name to be
set.NullPointerException
- If dn
was null
.Copyright 2010-2017 ForgeRock AS.