Package com.unboundid.ldap.sdk
Class CompactEntry
java.lang.Object
com.unboundid.ldap.sdk.CompactEntry
- All Implemented Interfaces:
Serializable
@NotMutable
@ThreadSafety(level=NOT_THREADSAFE)
public final class CompactEntry
extends Object
implements Serializable
This class provides a data structure that represents a compact version of an
entry. This is basically the same as an
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.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCompactEntry(Entry entry) Creates a new compact entry from the provided entry. -
Method Summary
Modifier and TypeMethodDescriptionbooleanIndicates whether the provided object is equal to this entry.getAttribute(String attributeName) Retrieves the attribute with the specified name.Retrieves the set of attributes contained in this entry.getAttributesWithOptions(String baseName, Set<String> options) Retrieves the list of attributes with the given base name and all of the specified options.getAttributeValue(String attributeName) Retrieves the value for the specified attribute, if available.getAttributeValueAsBoolean(String attributeName) Retrieves the value for the specified attribute as a Boolean, if available.getAttributeValueAsDate(String attributeName) Retrieves the value for the specified attribute as a Date, formatted using the generalized time syntax, if available.getAttributeValueAsDN(String attributeName) Retrieves the value for the specified attribute as a DN, if available.getAttributeValueAsInteger(String attributeName) Retrieves the value for the specified attribute as an Integer, if available.getAttributeValueAsLong(String attributeName) Retrieves the value for the specified attribute as a Long, if available.byte[][]getAttributeValueByteArrays(String attributeName) Retrieves the set of values for the specified attribute as byte arrays, if available.byte[]getAttributeValueBytes(String attributeName) Retrieves the value for the specified attribute as a byte array, if available.String[]getAttributeValues(String attributeName) Retrieves the set of values for the specified attribute, if available.getDN()Retrieves the DN for this entry.Retrieves the "objectClass" attribute from the entry, if available.String[]Retrieves the values of the "objectClass" attribute from the entry, if available.Retrieves the parent DN for this entry.Retrieves the parent DN for this entry as a string.Retrieves the parsed DN for this entry.getRDN()Retrieves the RDN for this entry.booleanhasAttribute(Attribute attribute) Indicates whether this entry contains the specified attribute.booleanhasAttribute(String attributeName) Indicates whether this entry contains the specified attribute.booleanhasAttributeValue(String attributeName, byte[] attributeValue) Indicates whether this entry contains an attribute with the given name and value.booleanhasAttributeValue(String attributeName, String attributeValue) Indicates whether this entry contains an attribute with the given name and value.inthashCode()Generates a hash code for this entry.booleanhasObjectClass(String objectClassName) Indicates whether this entry contains the specified object class.toEntry()Converts this compact entry to a full entry.String[]toLDIF()Retrieves an LDIF representation of this entry, with each attribute value on a separate line.String[]toLDIF(int wrapColumn) Retrieves an LDIF representation of this entry, with each attribute value on a separate line.voidtoLDIF(ByteStringBuffer buffer) Appends an LDIF representation of this entry to the provided buffer.voidtoLDIF(ByteStringBuffer buffer, int wrapColumn) Appends an LDIF representation of this entry to the provided buffer.Retrieves an LDIF-formatted string representation of this entry.toLDIFString(int wrapColumn) Retrieves an LDIF-formatted string representation of this entry.voidtoLDIFString(StringBuilder buffer) Appends an LDIF-formatted string representation of this entry to the provided buffer.voidtoLDIFString(StringBuilder buffer, int wrapColumn) Appends an LDIF-formatted string representation of this entry to the provided buffer.toString()Retrieves a string representation of this entry.voidtoString(StringBuilder buffer) Appends a string representation of this entry to the provided buffer.
-
Constructor Details
-
CompactEntry
Creates a new compact entry from the provided entry.- Parameters:
entry- The entry to use to create this compact entry. It must not benull.
-
-
Method Details
-
getDN
Retrieves the DN for this entry.- Returns:
- The DN for this entry.
-
getParsedDN
Retrieves the parsed DN for this entry.- Returns:
- The parsed DN for this entry.
- Throws:
LDAPException- If the DN string cannot be parsed as a valid DN.
-
getRDN
Retrieves the RDN for this entry.- Returns:
- The RDN for this entry, or
nullif the DN is the null DN. - Throws:
LDAPException- If the DN string cannot be parsed as a valid DN.
-
getParentDN
Retrieves the parent DN for this entry.- Returns:
- The parent DN for this entry, or
nullif there is no parent. - Throws:
LDAPException- If the DN string cannot be parsed as a valid DN.
-
getParentDNString
Retrieves the parent DN for this entry as a string.- Returns:
- The parent DN for this entry as a string, or
nullif there is no parent. - Throws:
LDAPException- If the DN string cannot be parsed as a valid DN.
-
hasAttribute
Indicates whether this entry contains the specified attribute.- Parameters:
attributeName- The name of the attribute for which to make the determination. It must not benull.- Returns:
trueif this entry contains the specified attribute, orfalseif not.
-
hasAttribute
Indicates whether this entry contains the specified attribute. It will only returntrueif this entry contains an attribute with the same name and exact set of values.- Parameters:
attribute- The attribute for which to make the determination. It must not benull.- Returns:
trueif this entry contains the specified attribute, orfalse.
-
hasAttributeValue
Indicates whether this entry contains an attribute with the given name and value.- Parameters:
attributeName- The name of the attribute for which to make the determination. It must not benull.attributeValue- The value for which to make the determination. It must not benull.- Returns:
trueif this entry contains an attribute with the specified name and value, orfalseif not.
-
hasAttributeValue
Indicates whether this entry contains an attribute with the given name and value.- Parameters:
attributeName- The name of the attribute for which to make the determination. It must not benull.attributeValue- The value for which to make the determination. It must not benull.- Returns:
trueif this entry contains an attribute with the specified name and value, orfalseif not.
-
hasObjectClass
Indicates whether this entry contains the specified object class.- Parameters:
objectClassName- The name of the object class for which to make the determination. It must not benull.- Returns:
trueif this entry contains the specified object class, orfalseif not.
-
getAttributes
Retrieves the set of attributes contained in this entry.- Returns:
- The set of attributes contained in this entry.
-
getAttribute
Retrieves the attribute with the specified name.- Parameters:
attributeName- The name of the attribute to retrieve. It must not benull.- Returns:
- The requested attribute from this entry, or
nullif the specified attribute is not present in this entry.
-
getAttributesWithOptions
@NotNull public List<Attribute> getAttributesWithOptions(@NotNull String baseName, @NotNull Set<String> options) Retrieves the list of attributes with the given base name and all of the specified options.- Parameters:
baseName- The base name (without any options) for the attribute to retrieve. It must not benull.options- The set of options that should be included in the attributes that are returned. It may be empty ornullif all attributes with the specified base name should be returned, regardless of the options that they contain (if any).- Returns:
- The list of attributes with the given base name and all of the specified options. It may be empty if there are no attributes with the specified base name and set of options.
-
getAttributeValue
Retrieves the value for the specified attribute, if available. If the attribute has more than one value, then the first value will be returned.- Parameters:
attributeName- The name of the attribute for which to retrieve the value. It must not benull.- Returns:
- The value for the specified attribute, or
nullif that attribute is not available.
-
getAttributeValueBytes
Retrieves the value for the specified attribute as a byte array, if available. If the attribute has more than one value, then the first value will be returned.- Parameters:
attributeName- The name of the attribute for which to retrieve the value. It must not benull.- Returns:
- The value for the specified attribute as a byte array, or
nullif that attribute is not available.
-
getAttributeValueAsBoolean
Retrieves the value for the specified attribute as a Boolean, if available. If the attribute has more than one value, then the first value will be returned. Values of "true", "t", "yes", "y", "on", and "1" will be interpreted asTRUE. Values of "false", "f", "no", "n", "off", and "0" will be interpreted asFALSE.- Parameters:
attributeName- The name of the attribute for which to retrieve the value. It must not benull.- Returns:
- The Boolean value parsed from the specified attribute, or
nullif that attribute is not available or the value cannot be parsed as a Boolean.
-
getAttributeValueAsDate
Retrieves the value for the specified attribute as a Date, formatted using the generalized time syntax, if available. If the attribute has more than one value, then the first value will be returned.- Parameters:
attributeName- The name of the attribute for which to retrieve the value. It must not benull.- Returns:
- The Date value parsed from the specified attribute, or
nullif that attribute is not available or the value cannot be parsed as a Date.
-
getAttributeValueAsDN
Retrieves the value for the specified attribute as a DN, if available. If the attribute has more than one value, then the first value will be returned.- Parameters:
attributeName- The name of the attribute for which to retrieve the value. It must not benull.- Returns:
- The Date value parsed from the specified attribute, or
nullif that attribute is not available or the value cannot be parsed as a DN.
-
getAttributeValueAsInteger
Retrieves the value for the specified attribute as an Integer, if available. If the attribute has more than one value, then the first value will be returned.- Parameters:
attributeName- The name of the attribute for which to retrieve the value. It must not benull.- Returns:
- The Integer value parsed from the specified attribute, or
nullif that attribute is not available or the value cannot be parsed as an Integer.
-
getAttributeValueAsLong
Retrieves the value for the specified attribute as a Long, if available. If the attribute has more than one value, then the first value will be returned.- Parameters:
attributeName- The name of the attribute for which to retrieve the value. It must not benull.- Returns:
- The Long value parsed from the specified attribute, or
nullif that attribute is not available or the value cannot be parsed as a Long.
-
getAttributeValues
Retrieves the set of values for the specified attribute, if available.- Parameters:
attributeName- The name of the attribute for which to retrieve the values. It must not benull.- Returns:
- The set of values for the specified attribute, or
nullif that attribute is not available.
-
getAttributeValueByteArrays
Retrieves the set of values for the specified attribute as byte arrays, if available.- Parameters:
attributeName- The name of the attribute for which to retrieve the values. It must not benull.- Returns:
- The set of values for the specified attribute as byte arrays, or
nullif that attribute is not available.
-
getObjectClassAttribute
Retrieves the "objectClass" attribute from the entry, if available.- Returns:
- The "objectClass" attribute from the entry, or
nullif that attribute not available.
-
getObjectClassValues
Retrieves the values of the "objectClass" attribute from the entry, if available.- Returns:
- The values of the "objectClass" attribute from the entry, or
nullif that attribute is not available.
-
toEntry
Converts this compact entry to a full entry.- Returns:
- The entry created from this compact entry.
-
hashCode
Generates a hash code for this entry. -
equals
Indicates whether the provided object is equal to this entry. The provided object will only be considered equal to this entry if it is an entry with the same DN and set of attributes. -
toLDIF
Retrieves an LDIF representation of this entry, with each attribute value on a separate line. Long lines will not be wrapped.- Returns:
- An LDIF representation of this entry.
-
toLDIF
Retrieves an LDIF representation of this entry, with each attribute value on a separate line. Long lines will be wrapped at the specified column.- Parameters:
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.- Returns:
- An LDIF representation of this entry.
-
toLDIF
Appends an LDIF representation of this entry to the provided buffer. Long lines will not be wrapped.- Parameters:
buffer- The buffer to which the LDIF representation of this entry should be written.
-
toLDIF
Appends an LDIF representation of this entry to the provided buffer.- Parameters:
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.
-
toLDIFString
Retrieves an LDIF-formatted string representation of this entry. No wrapping will be performed, and no extra blank lines will be added.- Returns:
- An LDIF-formatted string representation of this entry.
-
toLDIFString
Retrieves an LDIF-formatted string representation of this entry. No extra blank lines will be added.- Parameters:
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.- Returns:
- An LDIF-formatted string representation of this entry.
-
toLDIFString
Appends an LDIF-formatted string representation of this entry to the provided buffer. No wrapping will be performed, and no extra blank lines will be added.- Parameters:
buffer- The buffer to which to append the LDIF representation of this entry.
-
toLDIFString
Appends an LDIF-formatted string representation of this entry to the provided buffer. No extra blank lines will be added.- Parameters:
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.
-
toString
Retrieves a string representation of this entry. -
toString
Appends a string representation of this entry to the provided buffer.- Parameters:
buffer- The buffer to which to append the string representation of this entry.
-