Class PartialUpdate<T>

java.lang.Object
org.springframework.data.redis.core.PartialUpdate<T>
Type Parameters:
T -

public class PartialUpdate<T> extends Object
PartialUpdate allows to issue individual property updates without the need of rewriting the whole entity. It allows to define set, delete actions on existing objects while taking care of updating potential expiration times of the entity itself as well as index structures.
Since:
1.8
Author:
Christoph Strobl
  • Constructor Details

    • PartialUpdate

      public PartialUpdate(Object id, Class<T> targetType)
      Create new PartialUpdate for given id and type.
      Parameters:
      id - must not be null.
      targetType - must not be null.
    • PartialUpdate

      public PartialUpdate(Object id, T value)
      Create new PartialUpdate for given id and object.
      Parameters:
      id - must not be null.
      value - must not be null.
  • Method Details

    • newPartialUpdate

      public static <S> PartialUpdate<S> newPartialUpdate(Object id, Class<S> targetType)
      Create new PartialUpdate for given id and type.
      Parameters:
      id - must not be null.
      targetType - must not be null.
    • getValue

      @Nullable public T getValue()
      Returns:
      can be null.
    • set

      public PartialUpdate<T> set(String path, Object value)
      Set the value of a simple or complex value reachable via given path.
      Parameters:
      path - must not be null.
      value - must not be null. If you want to remove a value use del(String).
      Returns:
      a new PartialUpdate.
    • del

      public PartialUpdate<T> del(String path)
      Remove the value reachable via given path.
      Parameters:
      path - path must not be null.
      Returns:
      a new PartialUpdate.
    • getTarget

      public Class<T> getTarget()
      Get the target type.
      Returns:
      never null.
    • getId

      public Object getId()
      Get the id of the element to update.
      Returns:
      never null.
    • getPropertyUpdates

      public List<PartialUpdate.PropertyUpdate> getPropertyUpdates()
      Get the list of individual property updates.
      Returns:
      never null.
    • isRefreshTtl

      public boolean isRefreshTtl()
      Returns:
      true if expiration time of target should be updated.
    • refreshTtl

      public PartialUpdate<T> refreshTtl(boolean refreshTtl)
      Set indicator for updating expiration time of target.
      Parameters:
      refreshTtl -
      Returns:
      a new PartialUpdate.