@NotMutable @ThreadSafety(level=NOT_THREADSAFE) public final class CompactEntry extends java.lang.Object implements java.io.Serializable
Entry
object, except that
it stores the information in a more compact form that requires less space in
memory. This may be useful in applications that need to hold a large number
of entries in memory. Note that performance of some methods in this class
may be significantly worse than the performance of the corresponding methods
in the Entry
class.Entry
,
Serialized FormConstructor and Description |
---|
CompactEntry(Entry entry)
Creates a new compact entry from the provided entry.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o)
Indicates whether the provided object is equal to this entry.
|
Attribute |
getAttribute(java.lang.String attributeName)
Retrieves the attribute with the specified name.
|
java.util.Collection<Attribute> |
getAttributes()
Retrieves the set of attributes contained in this entry.
|
java.util.List<Attribute> |
getAttributesWithOptions(java.lang.String baseName,
java.util.Set<java.lang.String> options)
Retrieves the list of attributes with the given base name and all of the
specified options.
|
java.lang.String |
getAttributeValue(java.lang.String attributeName)
Retrieves the value for the specified attribute, if available.
|
java.lang.Boolean |
getAttributeValueAsBoolean(java.lang.String attributeName)
Retrieves the value for the specified attribute as a Boolean, if available.
|
java.util.Date |
getAttributeValueAsDate(java.lang.String attributeName)
Retrieves the value for the specified attribute as a Date, formatted using
the generalized time syntax, if available.
|
DN |
getAttributeValueAsDN(java.lang.String attributeName)
Retrieves the value for the specified attribute as a DN, if available.
|
java.lang.Integer |
getAttributeValueAsInteger(java.lang.String attributeName)
Retrieves the value for the specified attribute as an Integer, if
available.
|
java.lang.Long |
getAttributeValueAsLong(java.lang.String attributeName)
Retrieves the value for the specified attribute as a Long, if available.
|
byte[][] |
getAttributeValueByteArrays(java.lang.String attributeName)
Retrieves the set of values for the specified attribute as byte arrays, if
available.
|
byte[] |
getAttributeValueBytes(java.lang.String attributeName)
Retrieves the value for the specified attribute as a byte array, if
available.
|
java.lang.String[] |
getAttributeValues(java.lang.String attributeName)
Retrieves the set of values for the specified attribute, if available.
|
java.lang.String |
getDN()
Retrieves the DN for this entry.
|
Attribute |
getObjectClassAttribute()
Retrieves the "objectClass" attribute from the entry, if available.
|
java.lang.String[] |
getObjectClassValues()
Retrieves the values of the "objectClass" attribute from the entry, if
available.
|
DN |
getParentDN()
Retrieves the parent DN for this entry.
|
java.lang.String |
getParentDNString()
Retrieves the parent DN for this entry as a string.
|
DN |
getParsedDN()
Retrieves the parsed DN for this entry.
|
RDN |
getRDN()
Retrieves the RDN for this entry.
|
boolean |
hasAttribute(Attribute attribute)
Indicates whether this entry contains the specified attribute.
|
boolean |
hasAttribute(java.lang.String attributeName)
Indicates whether this entry contains the specified attribute.
|
boolean |
hasAttributeValue(java.lang.String attributeName,
byte[] attributeValue)
Indicates whether this entry contains an attribute with the given name and
value.
|
boolean |
hasAttributeValue(java.lang.String attributeName,
java.lang.String attributeValue)
Indicates whether this entry contains an attribute with the given name and
value.
|
int |
hashCode()
Generates a hash code for this entry.
|
boolean |
hasObjectClass(java.lang.String objectClassName)
Indicates whether this entry contains the specified object class.
|
Entry |
toEntry()
Converts this compact entry to a full entry.
|
java.lang.String[] |
toLDIF()
Retrieves an LDIF representation of this entry, with each attribute value
on a separate line.
|
void |
toLDIF(ByteStringBuffer buffer)
Appends an LDIF representation of this entry to the provided buffer.
|
void |
toLDIF(ByteStringBuffer buffer,
int wrapColumn)
Appends an LDIF representation of this entry to the provided buffer.
|
java.lang.String[] |
toLDIF(int wrapColumn)
Retrieves an LDIF representation of this entry, with each attribute value
on a separate line.
|
java.lang.String |
toLDIFString()
Retrieves an LDIF-formatted string representation of this entry.
|
java.lang.String |
toLDIFString(int wrapColumn)
Retrieves an LDIF-formatted string representation of this entry.
|
void |
toLDIFString(java.lang.StringBuilder buffer)
Appends an LDIF-formatted string representation of this entry to the
provided buffer.
|
void |
toLDIFString(java.lang.StringBuilder buffer,
int wrapColumn)
Appends an LDIF-formatted string representation of this entry to the
provided buffer.
|
java.lang.String |
toString()
Retrieves a string representation of this entry.
|
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this entry to the provided buffer.
|
public CompactEntry(@NotNull Entry entry)
entry
- The entry to use to create this compact entry. It must not
be null
.@NotNull public java.lang.String getDN()
@NotNull public DN getParsedDN() throws LDAPException
LDAPException
- If the DN string cannot be parsed as a valid DN.@Nullable public RDN getRDN() throws LDAPException
null
if the DN is the null DN.LDAPException
- If the DN string cannot be parsed as a valid DN.@Nullable public DN getParentDN() throws LDAPException
null
if there is no
parent.LDAPException
- If the DN string cannot be parsed as a valid DN.@Nullable public java.lang.String getParentDNString() throws LDAPException
null
if there
is no parent.LDAPException
- If the DN string cannot be parsed as a valid DN.public boolean hasAttribute(@NotNull java.lang.String attributeName)
attributeName
- The name of the attribute for which to make the
determination. It must not be null
.true
if this entry contains the specified attribute, or
false
if not.public boolean hasAttribute(@NotNull Attribute attribute)
true
if this entry contains an attribute with the same
name and exact set of values.attribute
- The attribute for which to make the determination. It
must not be null
.true
if this entry contains the specified attribute, or
false
.public boolean hasAttributeValue(@NotNull java.lang.String attributeName, @NotNull java.lang.String attributeValue)
attributeName
- The name of the attribute for which to make the
determination. It must not be null
.attributeValue
- The value for which to make the determination. It
must not be null
.true
if this entry contains an attribute with the
specified name and value, or false
if not.public boolean hasAttributeValue(@NotNull java.lang.String attributeName, @NotNull byte[] attributeValue)
attributeName
- The name of the attribute for which to make the
determination. It must not be null
.attributeValue
- The value for which to make the determination. It
must not be null
.true
if this entry contains an attribute with the
specified name and value, or false
if not.public boolean hasObjectClass(@NotNull java.lang.String objectClassName)
objectClassName
- The name of the object class for which to make the
determination. It must not be null
.true
if this entry contains the specified object class, or
false
if not.@NotNull public java.util.Collection<Attribute> getAttributes()
@Nullable public Attribute getAttribute(@NotNull java.lang.String attributeName)
attributeName
- The name of the attribute to retrieve. It must not
be null
.null
if the
specified attribute is not present in this entry.@NotNull public java.util.List<Attribute> getAttributesWithOptions(@NotNull java.lang.String baseName, @NotNull java.util.Set<java.lang.String> options)
baseName
- The base name (without any options) for the attribute to
retrieve. It must not be null
.options
- The set of options that should be included in the
attributes that are returned. It may be empty or
null
if all attributes with the specified base
name should be returned, regardless of the options that
they contain (if any).@Nullable public java.lang.String getAttributeValue(@NotNull java.lang.String attributeName)
attributeName
- The name of the attribute for which to retrieve the
value. It must not be null
.null
if that
attribute is not available.@Nullable public byte[] getAttributeValueBytes(@NotNull java.lang.String attributeName)
attributeName
- The name of the attribute for which to retrieve the
value. It must not be null
.null
if that attribute is not available.@Nullable public java.lang.Boolean getAttributeValueAsBoolean(@NotNull java.lang.String attributeName)
TRUE
. Values of "false", "f", "no", "n", "off", and
"0" will be interpreted as FALSE
.attributeName
- The name of the attribute for which to retrieve the
value. It must not be null
.null
if that attribute is not available or the value
cannot be parsed as a Boolean.@Nullable public java.util.Date getAttributeValueAsDate(@NotNull java.lang.String attributeName)
attributeName
- The name of the attribute for which to retrieve the
value. It must not be null
.null
if that attribute is not available or the value
cannot be parsed as a Date.@Nullable public DN getAttributeValueAsDN(@NotNull java.lang.String attributeName)
attributeName
- The name of the attribute for which to retrieve the
value. It must not be null
.null
if that attribute is not available or the value
cannot be parsed as a DN.@Nullable public java.lang.Integer getAttributeValueAsInteger(@NotNull java.lang.String attributeName)
attributeName
- The name of the attribute for which to retrieve the
value. It must not be null
.null
if that attribute is not available or the value
cannot be parsed as an Integer.@Nullable public java.lang.Long getAttributeValueAsLong(@NotNull java.lang.String attributeName)
attributeName
- The name of the attribute for which to retrieve the
value. It must not be null
.null
if that attribute is not available or the value
cannot be parsed as a Long.@Nullable public java.lang.String[] getAttributeValues(@NotNull java.lang.String attributeName)
attributeName
- The name of the attribute for which to retrieve the
values. It must not be null
.null
if
that attribute is not available.@Nullable public byte[][] getAttributeValueByteArrays(@NotNull java.lang.String attributeName)
attributeName
- The name of the attribute for which to retrieve the
values. It must not be null
.null
if that attribute is not available.@Nullable public Attribute getObjectClassAttribute()
null
if
that attribute not available.@Nullable public java.lang.String[] getObjectClassValues()
null
if that attribute is not available.@NotNull public Entry toEntry()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(@Nullable java.lang.Object o)
equals
in class java.lang.Object
o
- The object for which to make the determination.true
if the provided object is considered equal to this
entry, or false
if not.@NotNull public java.lang.String[] toLDIF()
@NotNull public java.lang.String[] toLDIF(int wrapColumn)
wrapColumn
- The column at which long lines should be wrapped. A
value less than or equal to two indicates that no
wrapping should be performed.public void toLDIF(@NotNull ByteStringBuffer buffer)
buffer
- The buffer to which the LDIF representation of this entry
should be written.public void toLDIF(@NotNull ByteStringBuffer buffer, int wrapColumn)
buffer
- The buffer to which the LDIF representation of this
entry should be written.wrapColumn
- The column at which long lines should be wrapped. A
value less than or equal to two indicates that no
wrapping should be performed.@NotNull public java.lang.String toLDIFString()
@NotNull public java.lang.String toLDIFString(int wrapColumn)
wrapColumn
- The column at which long lines should be wrapped. A
value less than or equal to two indicates that no
wrapping should be performed.public void toLDIFString(@NotNull java.lang.StringBuilder buffer)
buffer
- The buffer to which to append the LDIF representation of
this entry.public void toLDIFString(@NotNull java.lang.StringBuilder buffer, int wrapColumn)
buffer
- The buffer to which to append the LDIF representation
of this entry.wrapColumn
- The column at which long lines should be wrapped. A
value less than or equal to two indicates that no
wrapping should be performed.@NotNull public java.lang.String toString()
toString
in class java.lang.Object