Class Value<V>

java.lang.Object
ch.nolix.system.property.value.AbstractValue<V>
ch.nolix.system.property.value.Value<V>
Type Parameters:
V - is the type of the value of a Value.
All Implemented Interfaces:
INameHolder, EmptinessRequestable, MaterializationRequestable, IProperty, IBaseValue, IValue<V>

public final class Value<V> extends AbstractValue<V> implements IValue<V>
Author:
Silvan Wyss
  • Method Details

    • forBooleanWithNameAndDefaultValueAndSetter

      public static Value<Boolean> forBooleanWithNameAndDefaultValueAndSetter(String name, boolean defaultValue, Consumer<Boolean> setter)
      Parameters:
      name -
      defaultValue -
      setter -
      Returns:
      a new Value with the given name, defaultValue and setter and that will store a Boolean.
      Throws:
      RuntimeException - if the given name is null.
      RuntimeException - if the given name is blank.
      RuntimeException - if the given setter is null.
    • forDoubleWithNameAndDefaultValueAndSetter

      public static Value<Double> forDoubleWithNameAndDefaultValueAndSetter(String name, double defaultValue, Consumer<Double> setter)
      Parameters:
      name -
      defaultValue -
      setter -
      Returns:
      a new Value with the given name, defaultValue and setter and that will store a Double.
      Throws:
      RuntimeException - if the given name is null.
      RuntimeException - if the given name is blank.
      RuntimeException - if the given setter is null.
    • forIntWithNameAndDefaultValueAndSetter

      public static Value<Integer> forIntWithNameAndDefaultValueAndSetter(String name, int defaultValue, Consumer<Integer> setter)
      Parameters:
      name -
      defaultValue -
      setter -
      Returns:
      a new Value with the given name, defaultValue and setter and that will store a Integer.
      Throws:
      RuntimeException - if the given name is null.
      RuntimeException - if the given name is blank.
      RuntimeException - if the given setter is null.
    • forStringWithNameAndDefaultValueAndSetter

      public static Value<String> forStringWithNameAndDefaultValueAndSetter(String name, String defaultValue, Consumer<String> setter)
      Parameters:
      name -
      defaultValue -
      setter -
      Returns:
      a new Value with the given name, defaultValue and setter and that will store a String.
      Throws:
      RuntimeException - if the given name is null.
      RuntimeException - if the given name is blank.
      RuntimeException - if the given setter is null.
    • withNameAndDefaultValueAndSetterAndValueMapperAndSpecificationMapper

      public static <T> Value<T> withNameAndDefaultValueAndSetterAndValueMapperAndSpecificationMapper(String name, T defaultValue, Consumer<T> setter, Function<INode<?>,T> valueMapper, Function<T,INode<?>> specificationMapper)
      Type Parameters:
      T - is the type of the value of the created Value.
      Parameters:
      name -
      defaultValue -
      setter -
      valueMapper -
      specificationMapper -
      Returns:
      a new Value with the given name, defaultValue, setter, valueMapper and specificationMapper.
      Throws:
      RuntimeException - if the given name is null or blank.
      RuntimeException - if the given defaultValue is null.
      RuntimeException - if the given setter is null.
      RuntimeException - if the given valueMapper is null.
      RuntimeException - if the given specificationMapper is null.
    • fillUpAttributesIntoList

      public void fillUpAttributesIntoList(ILinkedList<INode<?>> list)
      Fills up the attributes of the current IProperty into the given list.
      Specified by:
      fillUpAttributesIntoList in interface IProperty
      Parameters:
      list -
    • getStoredValue

      public V getStoredValue()
      Specified by:
      getStoredValue in interface IValue<V>
      Returns:
      the value of the current IValue.
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface EmptinessRequestable
      Returns:
      true if EmptinessRequestable does not contain an element, false otherwise.
    • setValue

      public void setValue(V value)
      Sets the given value to the current IValue.
      Specified by:
      setValue in interface IValue<V>
      Parameters:
      value -