Record Class Modification

java.lang.Object
java.lang.Record
org.forgerock.opendj.ldap.Modification
Record Components:
modificationType - The type of modification to be performed.
attribute - The attribute containing the values to be modified.

public record Modification(ModificationType modificationType, Attribute attribute) extends Record
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));
       
  • 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.
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • modificationType

      public ModificationType modificationType()
      Returns the value of the modificationType record component.
      Returns:
      the value of the modificationType record component
    • attribute

      public Attribute attribute()
      Returns the value of the attribute record component.
      Returns:
      the value of the attribute record component