Class DefaultEntry

java.lang.Object
org.apache.directory.api.ldap.model.entry.DefaultEntry
All Implemented Interfaces:
Externalizable, Serializable, Cloneable, Iterable<Attribute>, Entry

public final class DefaultEntry extends Object implements Entry
A default implementation of a ServerEntry which should suite most use cases.

This class is final, it should not be extended.
Author:
Apache Directory Project
See Also:
  • Constructor Details

    • DefaultEntry

      public DefaultEntry()
      Creates a new instance of DefaultEntry.

      This entry must be initialized before being used !

    • DefaultEntry

      public DefaultEntry(SchemaManager schemaManager)

      Creates a new instance of DefaultEntry, schema aware.

      No attributes will be created.

      Parameters:
      schemaManager - The reference to the schemaManager
    • DefaultEntry

      public DefaultEntry(String dn) throws LdapInvalidDnException
      Creates a new instance of DefaultEntry, with a Dn.
      Parameters:
      dn - The String Dn for this serverEntry. Can be null.
      Throws:
      LdapInvalidDnException - If the Dn is invalid
    • DefaultEntry

      public DefaultEntry(Dn dn)
      Creates a new instance of DefaultEntry, with a Dn.
      Parameters:
      dn - The Dn for this serverEntry. Can be null.
    • DefaultEntry

      public DefaultEntry(SchemaManager schemaManager, String dn) throws LdapInvalidDnException

      Creates a new instance of DefaultEntry, schema aware.

      No attributes will be created.

      Parameters:
      schemaManager - The reference to the schemaManager
      dn - The String Dn for this serverEntry. Can be null.
      Throws:
      LdapInvalidDnException - If the Dn is invalid
    • DefaultEntry

      public DefaultEntry(SchemaManager schemaManager, Dn dn)

      Creates a new instance of DefaultEntry, schema aware.

      No attributes will be created.

      Parameters:
      schemaManager - The reference to the schemaManager
      dn - The Dn for this serverEntry. Can be null.
    • DefaultEntry

      public DefaultEntry(String dn, Object... elements) throws LdapException
      Creates a new instance of DefaultEntry, with a Dn and a list of IDs.
      Parameters:
      dn - The Dn for this serverEntry. Can be null.
      elements - The list of elements to inject in the entry
      Throws:
      LdapException - If the elements are invalid
      LdapException - If the provided Dn or elements are invalid
    • DefaultEntry

      public DefaultEntry(Dn dn, Object... elements) throws LdapException
      Creates a new instance of DefaultEntry, with a Dn and a list of IDs.
      Parameters:
      dn - The Dn for this serverEntry. Can be null.
      elements - The list of attributes to create.
      Throws:
      LdapException - If the provided Dn or elements are invalid
    • DefaultEntry

      public DefaultEntry(SchemaManager schemaManager, String dn, Object... elements) throws LdapException
      Creates a new instance of DefaultEntry, with a Dn and a list of IDs.
      Parameters:
      schemaManager - The SchemaManager
      dn - The Dn for this serverEntry. Can be null.
      elements - The list of attributes to create.
      Throws:
      LdapException - If the provided Dn or elements are invalid
    • DefaultEntry

      public DefaultEntry(SchemaManager schemaManager, Dn dn, Object... elements) throws LdapException
      Creates a new instance of DefaultEntry, with a Dn and a list of IDs.
      Parameters:
      schemaManager - The reference to the schemaManager
      dn - The Dn for this serverEntry. Can be null.
      elements - The list of attributes to create.
      Throws:
      LdapException - If the provided Dn or Elements are invalid
    • DefaultEntry

      public DefaultEntry(SchemaManager schemaManager, Entry entry) throws LdapException

      Creates a new instance of DefaultEntry, copying another entry.

      No attributes will be created.

      Parameters:
      schemaManager - The reference to the schemaManager
      entry - the entry to copy
      Throws:
      LdapException - If the provided entry is invalid
  • Method Details

    • createAttribute

      protected void createAttribute(String upId, AttributeType attributeType, byte[]... values) throws LdapInvalidAttributeValueException
      Add a new EntryAttribute, with its upId. If the upId is null, default to the AttributeType name. Updates the AttributeMap.
      Parameters:
      upId - The user provided ID for the attribute to create
      attributeType - The AttributeType to use
      values - The values to add to this attribute
      Throws:
      LdapInvalidAttributeValueException - If one of the value is incorrect
    • createAttribute

      protected void createAttribute(String upId, AttributeType attributeType, String... values) throws LdapInvalidAttributeValueException
      Add a new EntryAttribute, with its upId. If the upId is null, default to the AttributeType name. Updates the AttributeMap.
      Parameters:
      upId - The user provided ID for the attribute to create
      attributeType - The AttributeType to use
      values - The values to add to this attribute
      Throws:
      LdapInvalidAttributeValueException - If one of the value is incorrect
    • createAttribute

      protected void createAttribute(String upId, AttributeType attributeType, Value... values) throws LdapInvalidAttributeValueException
      Add a new EntryAttribute, with its upId. If the upId is null, default to the AttributeType name. Updates the AttributeMap.
      Parameters:
      upId - The user provided ID for the attribute to create
      attributeType - The AttributeType to use
      values - The values to add to this attribute
      Throws:
      LdapInvalidAttributeValueException - If one of the value is incorrect
    • getAttributeType

      protected AttributeType getAttributeType(String upId) throws LdapException
      Returns the attributeType from an Attribute ID.
      Parameters:
      upId - The ID we are looking for
      Returns:
      The found attributeType
      Throws:
      LdapException - If the lookup failed
    • add

      public Entry add(AttributeType attributeType, byte[]... values) throws LdapException

      Add an attribute (represented by its AttributeType and some binary values) into an entry.

      If we already have an attribute with the same values, the duplicated values are not added (duplicated values are not allowed)

      If the value cannot be added, or if the AttributeType is null or invalid, a LdapException is thrown.

      Specified by:
      add in interface Entry
      Parameters:
      attributeType - The attribute Type.
      values - The list of binary values to inject. It can be empty.
      Returns:
      the modified entry
      Throws:
      LdapException - If the attribute does not exist
    • add

      public Entry add(AttributeType attributeType, String... values) throws LdapException

      Add an attribute (represented by its AttributeType and some String values) into an entry.

      If we already have an attribute with the same values, the duplicated values are not added (duplicated values are not allowed)

      If the value cannot be added, or if the AttributeType is null or invalid, a LdapException is thrown.

      Specified by:
      add in interface Entry
      Parameters:
      attributeType - The attribute Type
      values - The list of binary values to inject. It can be empty
      Returns:
      the modified entry
      Throws:
      LdapException - If the attribute does not exist
    • add

      public Entry add(AttributeType attributeType, Value... values) throws LdapException

      Add an attribute (represented by its AttributeType and some values) into an entry.

      If we already have an attribute with the same values, the duplicated values are not added (duplicated values are not allowed)

      If the value cannot be added, or if the AttributeType is null or invalid, a LdapException is thrown.

      Specified by:
      add in interface Entry
      Parameters:
      attributeType - The attribute Type
      values - The list of binary values to inject. It can be empty
      Returns:
      the modified entry
      Throws:
      LdapException - If the attribute does not exist
    • add

      public Entry add(String upId, AttributeType attributeType, byte[]... values) throws LdapException

      Add an attribute (represented by its AttributeType and some binary values) into an entry. Set the User Provider ID at the same time

      If we already have an attribute with the same values, the duplicated values are not added (duplicated values are not allowed)

      If the value cannot be added, or if the AttributeType is null or invalid, a LdapException is thrown.

      Specified by:
      add in interface Entry
      Parameters:
      upId - The user provided ID for the added AttributeType
      attributeType - The attribute Type.
      values - The list of binary values to add. It can be empty.
      Returns:
      the modified entry
      Throws:
      LdapException - If the attribute does not exist
    • add

      public Entry add(String upId, AttributeType attributeType, Value... values) throws LdapException

      Add an attribute (represented by its AttributeType and some values) into an entry. Set the User Provider ID at the same time

      If we already have an attribute with the same values, nothing is done (duplicated values are not allowed)

      If the value cannot be added, or if the AttributeType is null or invalid, a LdapException is thrown.

      Specified by:
      add in interface Entry
      Parameters:
      upId - The user provided ID for the added AttributeType
      attributeType - The attribute Type.
      values - The list of values to add. It can be empty.
      Returns:
      the modified entry
      Throws:
      LdapException - If the attribute does not exist
    • add

      public Entry add(String upId, AttributeType attributeType, String... values) throws LdapException

      Add an attribute (represented by its AttributeType and some String values) into an entry. Set the User Provider ID at the same time

      If we already have an attribute with the same values, the duplicated values are not added (duplicated values are not allowed)

      If the value cannot be added, or if the AttributeType is null or invalid, a LdapException is thrown.

      Specified by:
      add in interface Entry
      Parameters:
      upId - The user provided ID for the added AttributeType
      attributeType - The attribute Type.
      values - The list of String values to add. It can be empty.
      Returns:
      the modified entry
      Throws:
      LdapException - If the attribute does not exist
    • add

      public Entry add(Attribute... attributes) throws LdapException
      Add some Attributes to the current Entry.
      Specified by:
      add in interface Entry
      Parameters:
      attributes - The attributes to add
      Returns:
      the modified entry
      Throws:
      LdapException - If we can't add any of the attributes
    • add

      public Entry add(String upId, byte[]... values) throws LdapException
      Add some binary values to the current Entry.
      Specified by:
      add in interface Entry
      Parameters:
      upId - The user provided ID of the attribute we want to add some values to
      values - The list of binary values to add
      Returns:
      the modified entry
      Throws:
      LdapException - If we can't add any of the values
    • add

      public Entry add(String upId, String... values) throws LdapException
      Add some String values to the current Entry.
      Specified by:
      add in interface Entry
      Parameters:
      upId - The user provided ID of the attribute we want to add some values to
      values - The list of String values to add
      Returns:
      the modified entry
      Throws:
      LdapException - If we can't add any of the values
    • add

      public Entry add(String upId, Value... values) throws LdapException
      Add some Values to the current Entry.
      Specified by:
      add in interface Entry
      Parameters:
      upId - The user provided ID of the attribute we want to add some values to
      values - The list of Values to add
      Returns:
      the modified entry
      Throws:
      LdapException - If we can't add any of the values
    • clone

      public Entry clone()
      Clone an entry. All the element are duplicated, so a modification on the original object won't affect the cloned object, as a modification on the cloned object has no impact on the original object
      Specified by:
      clone in interface Entry
      Overrides:
      clone in class Object
      Returns:
      a full copy of this entry
    • shallowClone

      public Entry shallowClone()
      Shallow clone an entry. We don't clone the Attributes
      Specified by:
      shallowClone in interface Entry
      Returns:
      a shallow copy of this entry
    • contains

      public boolean contains(Attribute... attributes)

      Checks if an entry contains a list of attributes.

      If the list is null or empty, this method will return true if the entry has no attribute, false otherwise.

      Specified by:
      contains in interface Entry
      Parameters:
      attributes - The Attributes to look for
      Returns:
      true if all the attributes are found within the entry, false if at least one of them is not present.
    • containsAttribute

      public boolean containsAttribute(String... attributes)
      Checks if an entry contains some specific attributes.
      Specified by:
      containsAttribute in interface Entry
      Parameters:
      attributes - The Attributes to look for.
      Returns:
      true if the attributes are all found within the entry.
    • containsAttribute

      public boolean containsAttribute(AttributeType attributeType)
      Checks if an entry contains a specific AttributeType.
      Specified by:
      containsAttribute in interface Entry
      Parameters:
      attributeType - The AttributeType to look for.
      Returns:
      true if the attribute is found within the entry.
    • contains

      public boolean contains(AttributeType attributeType, byte[]... values)
      Checks if an entry contains an attribute with some given binary values.
      Specified by:
      contains in interface Entry
      Parameters:
      attributeType - The Attribute we are looking for.
      values - The searched binary values.
      Returns:
      true if all the values are found within the attribute, false otherwise, or if the attributes does not exist.
    • contains

      public boolean contains(AttributeType attributeType, String... values)
      Checks if an entry contains an attribute with some given String values.
      Specified by:
      contains in interface Entry
      Parameters:
      attributeType - The Attribute we are looking for.
      values - The searched String values.
      Returns:
      true if all the values are found within the attribute, false otherwise, or if the attributes does not exist.
    • contains

      public boolean contains(AttributeType attributeType, Value... values)
      Checks if an entry contains an attribute with some given binary values.
      Specified by:
      contains in interface Entry
      Parameters:
      attributeType - The Attribute we are looking for.
      values - The searched values.
      Returns:
      true if all the values are found within the attribute, false otherwise, or if the attributes does not exist.
    • contains

      public boolean contains(String upId, byte[]... values)
      Checks if an entry contains an attribute with some binary values.
      Specified by:
      contains in interface Entry
      Parameters:
      upId - The Attribute we are looking for.
      values - The searched values.
      Returns:
      true if all the values are found within the attribute, false if at least one value is not present or if the ID is not valid.
    • contains

      public boolean contains(String upId, String... values)
      Checks if an entry contains an attribute with some String values.
      Specified by:
      contains in interface Entry
      Parameters:
      upId - The Attribute we are looking for.
      values - The searched values.
      Returns:
      true if all the values are found within the attribute, false if at least one value is not present or if the ID is not valid.
    • contains

      public boolean contains(String upId, Value... values)
      Checks if an entry contains an attribute with some values.
      Specified by:
      contains in interface Entry
      Parameters:
      upId - The Attribute we are looking for.
      values - The searched values.
      Returns:
      true if all the values are found within the attribute, false if at least one value is not present or if the ID is not valid.
    • get

      public Attribute get(String alias)

      Returns the attribute with the specified alias. The return value is null if no match is found.

      An Attribute with an id different from the supplied alias may be returned: for example a call with 'cn' may in some implementations return an Attribute whose getId() field returns 'commonName'.

      Specified by:
      get in interface Entry
      Parameters:
      alias - an aliased name of the attribute identifier
      Returns:
      the attribute associated with the alias, null otherwise
    • get

      public Attribute get(AttributeType attributeType)
      Returns the attribute associated with an AttributeType
      Specified by:
      get in interface Entry
      Parameters:
      attributeType - the AttributeType we are looking for
      Returns:
      the associated attribute, null otherwise
    • getAttributes

      public Collection<Attribute> getAttributes()
      Gets all the attributes
      Specified by:
      getAttributes in interface Entry
      Returns:
      The combined set of all the attributes.
    • put

      public Attribute put(String upId, byte[]... values)

      Put an attribute (represented by its ID and some binary values) into an entry.

      If the attribute already exists, the previous attribute will be replaced and returned.

      Specified by:
      put in interface Entry
      Parameters:
      upId - The attribute ID
      values - The list of binary values to put. It can be empty.
      Returns:
      The replaced attribute
    • put

      public Attribute put(String upId, String... values)

      Put an attribute (represented by its ID and some String values) into an entry.

      If the attribute already exists, the previous attribute will be replaced and returned.

      Specified by:
      put in interface Entry
      Parameters:
      upId - The attribute ID
      values - The list of String values to put. It can be empty.
      Returns:
      The replaced attribute
    • put

      public Attribute put(String upId, Value... values)

      Put an attribute (represented by its ID and some values) into an entry.

      If the attribute already exists, the previous attribute will be replaced and returned.

      Specified by:
      put in interface Entry
      Parameters:
      upId - The attribute ID
      values - The list of values to put. It can be empty.
      Returns:
      The replaced attribute
    • put

      public List<Attribute> put(Attribute... attributes) throws LdapException

      Places attributes in the attribute collection.

      If there is already an attribute with the same ID as any of the new attributes, the old ones are removed from the collection and are returned by this method. If there was no attribute with the same ID the return value is null.

      Specified by:
      put in interface Entry
      Parameters:
      attributes - the attributes to be put
      Returns:
      the old attributes with the same OID, if exist; otherwise null
      Throws:
      LdapException - if the operation fails
    • put

      public Attribute put(AttributeType attributeType, byte[]... values) throws LdapException

      Places a new attribute with the supplied AttributeType and binary values into the attribute collection.

      If there is already an attribute with the same AttributeType, the old one is removed from the collection and is returned by this method.

      This method provides a mechanism to put an attribute with a null value: the value may be null.

      Specified by:
      put in interface Entry
      Parameters:
      attributeType - the type of the new attribute to be put
      values - the binary values of the new attribute to be put
      Returns:
      the old attribute with the same identifier, if exists; otherwise null
      Throws:
      LdapException - if there are failures
    • put

      public Attribute put(AttributeType attributeType, String... values) throws LdapException

      Places a new attribute with the supplied AttributeType and String values into the attribute collection.

      If there is already an attribute with the same AttributeType, the old one is removed from the collection and is returned by this method.

      This method provides a mechanism to put an attribute with a null value: the value may be null.

      Specified by:
      put in interface Entry
      Parameters:
      attributeType - the type of the new attribute to be put
      values - the String values of the new attribute to be put
      Returns:
      the old attribute with the same identifier, if exists; otherwise null
      Throws:
      LdapException - if there are failures
    • put

      public Attribute put(AttributeType attributeType, Value... values) throws LdapException

      Places a new attribute with the supplied AttributeType and some values into the attribute collection.

      If there is already an attribute with the same AttributeType, the old one is removed from the collection and is returned by this method.

      This method provides a mechanism to put an attribute with a null value: the value may be null.

      Specified by:
      put in interface Entry
      Parameters:
      attributeType - the type of the new attribute to be put
      values - the values of the new attribute to be put
      Returns:
      the old attribute with the same identifier, if exists; otherwise null
      Throws:
      LdapException - if there are failures
    • put

      public Attribute put(String upId, AttributeType attributeType, byte[]... values) throws LdapException

      Places a new attribute with the supplied AttributeType and some binary values into the attribute collection.

      The given User provided ID will be used for this new AttributeEntry.

      If there is already an attribute with the same AttributeType, the old one is removed from the collection and is returned by this method.

      This method provides a mechanism to put an attribute with a null value: the value may be null.

      Specified by:
      put in interface Entry
      Parameters:
      upId - The User Provided ID to be stored into the AttributeEntry
      attributeType - The attributeType to use
      values - The values to store
      Returns:
      the old attribute with the same identifier, if exists; otherwise null
      Throws:
      LdapException - if there are failures.
    • put

      public Attribute put(String upId, AttributeType attributeType, String... values) throws LdapException

      Places a new attribute with the supplied AttributeType and some String values into the attribute collection.

      The given User provided ID will be used for this new AttributeEntry.

      If there is already an attribute with the same AttributeType, the old one is removed from the collection and is returned by this method.

      This method provides a mechanism to put an attribute with a null value: the value may be null.

      Specified by:
      put in interface Entry
      Parameters:
      upId - The User Provided ID to be stored into the AttributeEntry
      attributeType - the type of the new attribute to be put
      values - the String values of the new attribute to be put
      Returns:
      the old attribute with the same identifier, if exists; otherwise null
      Throws:
      LdapException - if there are failures.
    • put

      public Attribute put(String upId, AttributeType attributeType, Value... values) throws LdapException

      Places a new attribute with the supplied AttributeType and some values into the attribute collection.

      The given User provided ID will be used for this new AttributeEntry.

      If there is already an attribute with the same AttributeType, the old one is removed from the collection and is returned by this method.

      This method provides a mechanism to put an attribute with a null value: the value may be null.

      Specified by:
      put in interface Entry
      Parameters:
      upId - The User Provided ID to be stored into the AttributeEntry
      attributeType - the type of the new attribute to be put
      values - the values of the new attribute to be put
      Returns:
      the old attribute with the same identifier, if exists; otherwise null
      Throws:
      LdapException - if there are failures.
    • remove

      public List<Attribute> remove(Attribute... attributes) throws LdapException
      Removes the specified attributes. The removed attributes are returned by this method. If there were no attribute the return value is null.
      Specified by:
      remove in interface Entry
      Parameters:
      attributes - the attributes to be removed
      Returns:
      the removed attribute, if exists; otherwise null
      Throws:
      LdapException - If the removal failed
    • remove

      public boolean remove(AttributeType attributeType, byte[]... values) throws LdapException

      Removes the specified binary values from an attribute.

      If at least one value is removed, this method returns true.

      If there is no more value after having removed the values, the attribute will be removed too.

      If the attribute does not exist, nothing is done and the method returns false

      Specified by:
      remove in interface Entry
      Parameters:
      attributeType - The attribute type
      values - the values to be removed
      Returns:
      true if at least a value is removed, false if not all the values have been removed or if the attribute does not exist.
      Throws:
      LdapException - If the removal failed
    • remove

      public boolean remove(AttributeType attributeType, String... values) throws LdapException

      Removes the specified String values from an attribute.

      If at least one value is removed, this method returns true.

      If there is no more value after having removed the values, the attribute will be removed too.

      If the attribute does not exist, nothing is done and the method returns false

      Specified by:
      remove in interface Entry
      Parameters:
      attributeType - The attribute type
      values - the values to be removed
      Returns:
      true if at least a value is removed, false if not all the values have been removed or if the attribute does not exist.
      Throws:
      LdapException - If the removal failed
    • remove

      public boolean remove(AttributeType attributeType, Value... values) throws LdapException

      Removes the specified values from an attribute.

      If at least one value is removed, this method returns true.

      If there is no more value after having removed the values, the attribute will be removed too.

      If the attribute does not exist, nothing is done and the method returns false

      Specified by:
      remove in interface Entry
      Parameters:
      attributeType - The attribute type
      values - the values to be removed
      Returns:
      true if at least a value is removed, false if not all the values have been removed or if the attribute does not exist.
      Throws:
      LdapException - If the removal failed
    • removeAttributes

      public void removeAttributes(AttributeType... attributes)

      Removes the attribute with the specified AttributeTypes.

      The removed attribute are returned by this method.

      If there is no attribute with the specified AttributeTypes, the return value is null.

      Specified by:
      removeAttributes in interface Entry
      Parameters:
      attributes - the AttributeTypes to be removed
    • removeAttributes

      public void removeAttributes(String... attributes)

      Removes the attribute with the specified alias.

      The removed attribute are returned by this method.

      If there is no attribute with the specified alias, the return value is null.

      Specified by:
      removeAttributes in interface Entry
      Parameters:
      attributes - an aliased name of the attribute to be removed
    • remove

      public boolean remove(String upId, byte[]... values) throws LdapException

      Removes the specified binary values from an attribute.

      If at least one value is removed, this method returns true.

      If there is no more value after having removed the values, the attribute will be removed too.

      If the attribute does not exist, nothing is done and the method returns false

      Specified by:
      remove in interface Entry
      Parameters:
      upId - The attribute ID
      values - the values to be removed
      Returns:
      true if at least a value is removed, false if not all the values have been removed or if the attribute does not exist.
      Throws:
      LdapException - If the removal failed
    • remove

      public boolean remove(String upId, String... values) throws LdapException

      Removes the specified String values from an attribute.

      If at least one value is removed, this method returns true.

      If there is no more value after having removed the values, the attribute will be removed too.

      If the attribute does not exist, nothing is done and the method returns false

      Specified by:
      remove in interface Entry
      Parameters:
      upId - The attribute ID
      values - the attributes to be removed
      Returns:
      true if at least a value is removed, false if not all the values have been removed or if the attribute does not exist.
      Throws:
      LdapException - If the provided values are invalid
    • remove

      public boolean remove(String upId, Value... values) throws LdapException

      Removes the specified values from an attribute.

      If at least one value is removed, this method returns true.

      If there is no more value after having removed the values, the attribute will be removed too.

      If the attribute does not exist, nothing is done and the method returns false

      Specified by:
      remove in interface Entry
      Parameters:
      upId - The attribute ID
      values - the attributes to be removed
      Returns:
      true if at least a value is removed, false if not all the values have been removed or if the attribute does not exist.
      Throws:
      LdapException - if the attribute does not exists
    • getDn

      public Dn getDn()
      Get this entry's Dn.
      Specified by:
      getDn in interface Entry
      Returns:
      The entry's Dn
    • setDn

      public void setDn(Dn dn)
      Set this entry's Dn.
      Specified by:
      setDn in interface Entry
      Parameters:
      dn - The Dn associated with this entry
    • setDn

      public void setDn(String dn) throws LdapInvalidDnException
      Set this entry's Dn.
      Specified by:
      setDn in interface Entry
      Parameters:
      dn - The String Dn associated with this entry
      Throws:
      LdapInvalidDnException - if the provided Dn is invalid
    • clear

      public void clear()
      Remove all the attributes for this entry. The Dn is not reset
      Specified by:
      clear in interface Entry
    • iterator

      public Iterator<Attribute> iterator()
      Returns an enumeration containing the zero or more attributes in the collection. The behavior of the enumeration is not specified if the attribute collection is changed.
      Specified by:
      iterator in interface Entry
      Specified by:
      iterator in interface Iterable<Attribute>
      Returns:
      an enumeration of all contained attributes
    • size

      public int size()
      Returns the number of attributes.
      Specified by:
      size in interface Entry
      Returns:
      the number of attributes
    • writeExternal

      public void writeExternal(ObjectOutput out) throws IOException
      This is the place where we serialize entries, and all theirs elements.
      The structure used to store the entry is the following :
      • [Dn] : If it's null, stores an empty Dn
      • [attributes number] : the number of attributes.
      • [attribute]* : each attribute, if we have some
      Specified by:
      writeExternal in interface Externalizable
      Throws:
      IOException
    • readExternal

      public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
      Specified by:
      readExternal in interface Externalizable
      Throws:
      IOException
      ClassNotFoundException
    • hashCode

      public int hashCode()
      Get the hash code of this ClientEntry. The Attributes will be sorted before the comparison can be done.
      Overrides:
      hashCode in class Object
      Returns:
      the instance's hash code
      See Also:
    • hasObjectClass

      public boolean hasObjectClass(String... objectClasses)
      Tells if an entry as some specific ObjectClasses values
      Specified by:
      hasObjectClass in interface Entry
      Parameters:
      objectClasses - The ObjectClasses we want to check
      Returns:
      true if all the ObjectClasses value are present in the ObjectClass attribute
    • hasObjectClass

      public boolean hasObjectClass(Attribute... objectClasses)
      Tells if an entry has some specific ObjectClasses Attributes
      Specified by:
      hasObjectClass in interface Entry
      Parameters:
      objectClasses - The ObjectClasses we want to check
      Returns:
      true if the ObjectClasses Attribute are present in the ObjectClass attribute
    • isSchemaAware

      public boolean isSchemaAware()
      Tells if the Entry is schema aware
      Specified by:
      isSchemaAware in interface Entry
      Returns:
      true if the Entry is schema aware
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also:
    • toString

      public String toString(String tabs)
      A pretty-pinter for Entries
      Specified by:
      toString in interface Entry
      Parameters:
      tabs - The tabs to add before any output
      Returns:
      The pretty-printed entry