Class Modification

java.lang.Object
org.forgerock.opendj.ldap.Modification

public final class Modification extends Object
A modification to be performed on an entry during a Modify operation.
  • Constructor Details

    • Modification

      public Modification(ModificationType modificationType, Attribute attribute)
      Creates a new modification having the provided modification type and attribute values to be updated. Note that while the returned Modification is immutable, the underlying attribute may not be. The following code ensures that the returned Modification is fully immutable:
       Modification change = new Modification(modificationType, Attributes
               .unmodifiableAttribute(attribute));
       
      Parameters:
      modificationType - The type of modification to be performed.
      attribute - The the attribute containing the values to be modified.
  • Method Details

    • add

      public static Modification add(String attributeDescription, Object... values)
      Returns a new modification for adding an attribute with the provided description and values.
      Parameters:
      attributeDescription - The description of the attribute to be added.
      values - The values of the attribute to be added.
      Returns:
      a new ADD modification.
    • delete

      public static Modification delete(String attributeDescription, Object... values)
      Returns a new DELETE modification. If no values are provided, returns a modification for deleting the provided attribute. If one or more values are provided, returns a modification for deleting these values only.
      Parameters:
      attributeDescription - The description of the attribute targeted by the modification.
      values - An optional list of attribute values, if specified, the returned modification will be intended to delete these values only.
      Returns:
      a new DELETE modification.
    • replace

      public static Modification replace(String attributeDescription, Object... values)
      Returns a new modification for replacing all the values of the provided attribute with the provided values. If the modification is applyied to an entry that does not contain the attribute, it is equivalent to an ADD modification.
      Parameters:
      attributeDescription - The description of the attribute whose values should be replaced.
      values - The new values for the attribute.
      Returns:
      a new REPLACE modification.
    • withValues

      public Modification withValues(Object... values)
      Adds values to this modification's attribute.
      Parameters:
      values - The values to be added to this modification's attribute.
      Returns:
      this modification.
    • getAttribute

      public Attribute getAttribute()
      Returns the attribute containing the values to be modified.
      Returns:
      The the attribute containing the values to be modified.
    • getModificationType

      public ModificationType getModificationType()
      Returns the type of modification to be performed.
      Returns:
      The type of modification to be performed.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object