Interface AnyValued<Type>

All Superinterfaces:
AnyProvider
All Known Implementing Classes:
EntryNode

public interface AnyValued<Type> extends AnyProvider
A provider for anything with a value. Anything implementing this (or convertible to this) can be used by the ExprValue property expression.
See Also:
  • Method Details

    • value

      @UnknownNullability Type value()
      Returns:
      This thing's value
    • convertedValue

      default <Converted> Converted convertedValue(ClassInfo<Converted> expected)
    • supportsValueChange

      default boolean supportsValueChange()
      This is called before changeValue(Object). If the result is false, setting the value will never be attempted.
      Returns:
      Whether this supports being set
    • changeValue

      default void changeValue(Type value) throws UnsupportedOperationException
      The behaviour for changing this thing's value, if possible. If not possible, then supportsValueChange() should return false and this may throw an error.
      Parameters:
      value - The new value
      Throws:
      UnsupportedOperationException - If this is impossible
    • valueType

      Class<Type> valueType()
      Returns:
      The type of values this accepts (or provides)
    • resetValue

      default void resetValue() throws UnsupportedOperationException
      A default implementation of 'resetting' the value (setting it to null). Implementations should override this if different behaviour is required.
      Throws:
      UnsupportedOperationException - If changing is not supported
    • changeValueSafely

      default void changeValueSafely(Object value) throws UnsupportedOperationException
      This method can be overridden to filter out bad values (e.g. null, objects of the wrong type, etc.) and make sure changeValue(Object) is not called with a bad parameter.
      Parameters:
      value - The (unchecked) new value
      Throws:
      UnsupportedOperationException