Class Property<T>

java.lang.Object
com.sap.cloud.sdk.cloudplatform.thread.Property<T>
Type Parameters:
T - The generic value type.

public class Property<T> extends Object
Represents a ThreadContext property with a given value (or exception, if the value could not be determined).
  • Constructor Details

    • Property

      protected Property(@Nonnull io.vavr.control.Try<T> value, boolean isConfidential)
      Creates a property.
      Parameters:
      value - A Try that might contain the value of the property.
      isConfidential - Whether the property must be handled confidentially, e.g., it should not be written to log files and toString() should not reveal the value or exception.
  • Method Details

    • of

      @Nonnull public static <T> Property<T> of(@Nonnull T value)
      Creates a non-confidential property from the given value.
      Type Parameters:
      T - The generic value type.
      Parameters:
      value - The value to create a property instance for.
      Returns:
      A new property instance.
    • ofConfidential

      @Nonnull public static <T> Property<T> ofConfidential(@Nonnull T confidentialValue)
      Creates a confidential property from the given value.
      Type Parameters:
      T - The generic value type.
      Parameters:
      confidentialValue - The confidential value to create a confidential property instance for.
      Returns:
      A new property instance.
    • ofTry

      @Nonnull public static <T> Property<T> ofTry(@Nonnull io.vavr.control.Try<T> valueTry)
      Creates a non-confidential property from a given Try of a value.
      Type Parameters:
      T - The generic value type.
      Parameters:
      valueTry - A Try value.
      Returns:
      A new property value wrapped in Try.
    • ofConfidentialTry

      @Nonnull public static <T> Property<T> ofConfidentialTry(@Nonnull io.vavr.control.Try<T> confidentialValueTry)
      Creates a confidential property from a given Try of a value.
      Type Parameters:
      T - The generic value type.
      Parameters:
      confidentialValueTry - A confidential Try value.
      Returns:
      A new confidential property value wrapped in Try.
    • decorateCallable

      @Nonnull public static Callable<Property<?>> decorateCallable(@Nonnull Callable<?> valueGenerator)
      Decorate a callable, wrapping its return value into a property for convenience.
      Parameters:
      valueGenerator - A producer of a property value.
      Returns:
      The wrapped callable.
    • decorateConfidentialCallable

      @Nonnull public static Callable<Property<?>> decorateConfidentialCallable(@Nonnull Callable<?> valueGenerator)
      Decorate a callable, wrapping its return value into a confidential property for convenience.
      Parameters:
      valueGenerator - A producer of a confidential property value.
      Returns:
      The wrapped callable.
    • toString

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

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(@Nullable Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getValue

      @Nonnull public io.vavr.control.Try<T> getValue()
    • isConfidential

      public boolean isConfidential()