Class AbstractEntry

java.lang.Object
org.forgerock.opendj.ldap.AbstractEntry
All Implemented Interfaces:
Entry
Direct Known Subclasses:
LinkedHashMapEntry, TreeMapEntry

public abstract class AbstractEntry extends Object implements Entry
This class provides a skeletal implementation of the Entry interface, to minimize the effort required to implement this interface.
  • Constructor Details

  • Method Details

    • addAttribute

      public boolean addAttribute(Attribute attribute)
      Description copied from interface: Entry
      Ensures that this entry contains the provided attribute and values (optional operation). This method has the following semantics:
      • If this entry does not already contain an attribute with a matching attribute description, then this entry will be modified such that it contains attribute, even if it is empty.
      • If this entry already contains an attribute with a 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.

      Specified by:
      addAttribute in interface Entry
      Parameters:
      attribute - The attribute values to be added to this entry, merging with any existing attribute values.
      Returns:
      true if this entry changed as a result of this call.
    • addAttribute

      public Entry addAttribute(String attributeDescription, Object... values)
      Description copied from interface: Entry
      Ensures that this entry contains the provided attribute and values (optional operation). This method has the following semantics:
      • If this entry does not already contain an attribute with a matching attribute description, then this entry will be modified such that it contains attribute, even if it is empty.
      • If this entry already contains an attribute with a 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.

      Specified by:
      addAttribute in interface Entry
      Parameters:
      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.
      Returns:
      This entry.
    • containsAttribute

      public boolean containsAttribute(Attribute attribute, Collection<? super ByteString> missingValues)
      Description copied from interface: Entry
      Returns 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.
      Specified by:
      containsAttribute in interface Entry
      Parameters:
      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.
      Returns:
      true if this entry contains all of the attribute values contained in attribute.
    • containsAttribute

      public boolean containsAttribute(String attributeDescription, Object... values)
      Description copied from interface: Entry
      Returns 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.

      Specified by:
      containsAttribute in interface Entry
      Parameters:
      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.
      Returns:
      true if this entry contains all of the attribute values contained in values.
    • equals

      public boolean equals(Object object)
      Description copied from interface: Entry
      Returns 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.
      Specified by:
      equals in interface Entry
      Overrides:
      equals in class Object
      Parameters:
      object - The object to be tested for equality with this entry.
      Returns:
      true if object is an entry which is equal to this entry, or false if not.
    • getAllAttributes

      public Iterable<Attribute> getAllAttributes(AttributeDescription attributeDescription)
      Description copied from interface: Entry
      Returns an 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.
      Specified by:
      getAllAttributes in interface Entry
      Parameters:
      attributeDescription - The name of the attributes to be returned.
      Returns:
      An Iterable containing the matching attributes.
    • getAllAttributes

      public Iterable<Attribute> getAllAttributes(String attributeDescription)
      Description copied from interface: Entry
      Returns an 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).

      Specified by:
      getAllAttributes in interface Entry
      Parameters:
      attributeDescription - The name of the attributes to be returned.
      Returns:
      An Iterable containing the matching attributes.
    • getAttribute

      public Attribute getAttribute(AttributeDescription attributeDescription)
      Description copied from interface: Entry
      Returns the named attribute contained in this entry, or null if it is not included with this entry.
      Specified by:
      getAttribute in interface Entry
      Parameters:
      attributeDescription - The name of the attribute to be returned.
      Returns:
      The named attribute, or null if it is not included with this entry.
    • getAttribute

      public Attribute getAttribute(String attributeDescription)
      Description copied from interface: Entry
      Returns the named attribute contained in this entry, or 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).

      Specified by:
      getAttribute in interface Entry
      Parameters:
      attributeDescription - The name of the attribute to be returned.
      Returns:
      The named attribute, or null if it is not included with this entry.
    • hashCode

      public int hashCode()
      Description copied from interface: Entry
      Returns the hash code for this entry. It will be calculated as the sum of the hash codes of the distinguished name and all of the attributes.
      Specified by:
      hashCode in interface Entry
      Overrides:
      hashCode in class Object
      Returns:
      The hash code for this entry.
    • parseAttribute

      public AttributeParser parseAttribute(AttributeDescription attributeDescription)
      Description copied from interface: Entry
      Returns a parser for the named attribute contained in this entry.
      Specified by:
      parseAttribute in interface Entry
      Parameters:
      attributeDescription - The name of the attribute to be parsed.
      Returns:
      A parser for the named attribute.
    • parseAttribute

      public AttributeParser parseAttribute(String attributeDescription)
      Description copied from interface: Entry
      Returns a parser for the named attribute contained in this entry.

      The attribute description will be decoded using the schema associated with this entry (usually the default schema).

      Specified by:
      parseAttribute in interface Entry
      Parameters:
      attributeDescription - The name of the attribute to be parsed.
      Returns:
      A parser for the named attribute.
    • removeAttribute

      public boolean removeAttribute(Attribute attribute, Collection<? super ByteString> missingValues)
      Description copied from interface: Entry
      Removes all of the attribute values contained in 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.

      Specified by:
      removeAttribute in interface Entry
      Parameters:
      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.
      Returns:
      true if this entry changed as a result of this call.
    • removeAttribute

      public boolean removeAttribute(AttributeDescription attributeDescription)
      Description copied from interface: Entry
      Removes the named attribute from this entry if it is present (optional operation). If this attribute does not contain the attribute, the call leaves this entry unchanged and returns false.
      Specified by:
      removeAttribute in interface Entry
      Parameters:
      attributeDescription - The name of the attribute to be removed.
      Returns:
      true if this entry changed as a result of this call.
    • removeAttribute

      public Entry removeAttribute(String attributeDescription, Object... values)
      Description copied from interface: Entry
      Removes all of the attribute values contained in 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.

      Specified by:
      removeAttribute in interface Entry
      Parameters:
      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.
      Returns:
      This entry.
    • replaceAttribute

      public boolean replaceAttribute(Attribute attribute)
      Description copied from interface: Entry
      Adds all of the attribute values contained in 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.

      Specified by:
      replaceAttribute in interface Entry
      Parameters:
      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.
      Returns:
      true if this entry changed as a result of this call.
    • replaceAttribute

      public Entry replaceAttribute(String attributeDescription, Object... values)
      Description copied from interface: Entry
      Adds all of the attribute values contained in 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.

      Specified by:
      replaceAttribute in interface Entry
      Parameters:
      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.
      Returns:
      This entry.
    • setName

      public Entry setName(String dn)
      Description copied from interface: Entry
      Sets the distinguished name of this entry (optional operation).

      The distinguished name will be decoded using the schema associated with this entry (usually the default schema).

      Specified by:
      setName in interface Entry
      Parameters:
      dn - The string representation of the distinguished name.
      Returns:
      This entry.
    • toString

      public String toString()
      Description copied from interface: Entry
      Returns a string representation of this entry.
      Specified by:
      toString in interface Entry
      Overrides:
      toString in class Object
      Returns:
      The string representation of this entry.