Interface EncryptionContext


public interface EncryptionContext
Context to encapsulate encryption for a specific MongoPersistentProperty.
Since:
4.1
Author:
Christoph Strobl
  • Method Details

    • getProperty

      Returns the MongoPersistentProperty to be handled.
      Returns:
      will never be null.
    • convertToMongoType

      Object convertToMongoType(Object value)
      Shortcut for converting a given value into its store representation using the root ValueConversionContext.
      Parameters:
      value -
      Returns:
    • read

      default <T> T read(@Nullable Object value)
      Reads the value as an instance of the property type.
      Parameters:
      value - value to be read; can be null.
      Returns:
      can be null.
      Throws:
      IllegalStateException - if value cannot be read as an instance of type.
    • read

      default <T> T read(@Nullable Object value, Class<T> target)
      Reads the value as an instance of type.
      Parameters:
      value - value to be read; can be null.
      target - type of value to be read; must not be null.
      Returns:
      can be null.
      Throws:
      IllegalStateException - if value cannot be read as an instance of type.
    • read

      <T> T read(@Nullable Object value, TypeInformation<T> target)
      Reads the value as an instance of type.
      Parameters:
      value - value to be read; can be null.
      target - type of value to be read; must not be null.
      Returns:
      can be null.
      Throws:
      IllegalStateException - if value cannot be read as an instance of type.
    • write

      @Nullable default <T> T write(@Nullable Object value)
      Write the value as an instance of the property type.
      Parameters:
      value - value to write; can be null.
      Returns:
      can be null.
      Throws:
      IllegalStateException - if value cannot be written as an instance of the property type.
      See Also:
    • write

      @Nullable default <T> T write(@Nullable Object value, Class<T> target)
      Write the value as an instance of type.
      Parameters:
      value - value to write; can be null.
      target - type of value to be written; must not be null.
      Returns:
      can be null.
      Throws:
      IllegalStateException - if value cannot be written as an instance of type.
    • write

      @Nullable <T> T write(@Nullable Object value, TypeInformation<T> target)
      Write the value as an instance of given type.
      Parameters:
      value - value to write; can be null.
      target - type of value to be written; must not be null.
      Returns:
      can be null.
      Throws:
      IllegalStateException - if value cannot be written as an instance of type.
    • lookupValue

      @Nullable Object lookupValue(String path)
      Lookup the value for a given path within the current context.
      Parameters:
      path - the path/property name to resolve the current value for.
      Returns:
      can be null.
    • getEvaluationContext

      org.springframework.expression.EvaluationContext getEvaluationContext(Object source)