java.lang.Object
org.springframework.data.cassandra.core.query.Update

public class Update extends Object
Update object representing a set of update operations. Update objects can be created in a fluent style. Each construction operation creates a new immutable Update object.
 Update update = Update.empty().set("foo", "bar").addTo("baz").prependAll(listOfValues);
 
Since:
2.0
Author:
Mark Paluch, Chema Vinacua
  • Method Details

    • empty

      public static Update empty()
      Create an empty Update object.
      Returns:
      a new, empty Update.
    • of

      public static Update of(Iterable<Update.AssignmentOp> assignmentOps)
      Create a Update object given a list of Update.AssignmentOps.
      Parameters:
      assignmentOps - must not be null.
    • update

      public static Update update(String columnName, @Nullable Object value)
      Set the columnName to value.
      Returns:
      a new Update.
    • set

      public Update set(String columnName, @Nullable Object value)
      Set the columnName to value.
      Parameters:
      columnName - must not be null.
      value - value to set on column with name, may be null.
      Returns:
      a new Update object containing the merge result of the existing assignments and the current assignment.
    • set

      public Update.SetBuilder set(String columnName)
      Create a new Update.SetBuilder to set a collection item for columnName in a fluent style.
      Parameters:
      columnName - must not be null.
      Returns:
      a new Update.AddToBuilder to build an set assignment.
    • addTo

      public Update.AddToBuilder addTo(String columnName)
      Create a new Update.AddToBuilder to add items to a collection for columnName in a fluent style.
      Parameters:
      columnName - must not be null.
      Returns:
      a new Update.AddToBuilder to build an add-to assignment.
    • removeFrom

      public Update.RemoveFromBuilder removeFrom(String columnName)
      Create a new Update.RemoveFromBuilder to remove items from a collection for columnName in a fluent style.
      Parameters:
      columnName - must not be null.
      Returns:
      a new Update.RemoveFromBuilder to build an remove-from assignment.
      Since:
      3.1.4
    • remove

      public Update remove(String columnName, Object value)
      Remove value from the collection at columnName.
      Parameters:
      columnName - must not be null.
      value - must not be null.
      Returns:
      a new Update object containing the merge result of the existing assignments and the current assignment.
    • clear

      public Update clear(String columnName)
      Cleat the collection at columnName.
      Parameters:
      columnName - must not be null.
      Returns:
      a new Update object containing the merge result of the existing assignments and the current assignment.
    • increment

      public Update increment(String columnName)
      Increment the value at columnName by 1.
      Parameters:
      columnName - must not be null.
      Returns:
      a new Update object containing the merge result of the existing assignments and the current assignment.
    • increment

      public Update increment(String columnName, Number delta)
      Increment the value at columnName by delta.
      Parameters:
      columnName - must not be null.
      delta - increment value.
      Returns:
      a new Update object containing the merge result of the existing assignments and the current assignment.
    • decrement

      public Update decrement(String columnName)
      Decrement the value at columnName by 1.
      Parameters:
      columnName - must not be null.
      Returns:
      a new Update object containing the merge result of the existing assignments and the current assignment.
    • decrement

      public Update decrement(String columnName, Number delta)
      Decrement the value at columnName by delta.
      Parameters:
      columnName - must not be null.
      delta - decrement value.
      Returns:
      a new Update object containing the merge result of the existing assignments and the current assignment.
    • getUpdateOperations

      public Collection<Update.AssignmentOp> getUpdateOperations()
      Returns:
      Collection of update operations.
    • toString

      public String toString()
      Overrides:
      toString in class Object