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 aValue.
- All Implemented Interfaces:
INameHolder, EmptinessRequestable, MaterializationRequestable, IProperty, IBaseValue, IValue<V>
- Author:
- Silvan Wyss
-
Method Summary
Modifier and TypeMethodDescriptionvoidfillUpAttributesIntoList(ILinkedList<INode<?>> list) Fills up the attributes of the currentIPropertyinto the given list.forBooleanWithNameAndDefaultValueAndSetter(String name, boolean defaultValue, Consumer<Boolean> setter) forDoubleWithNameAndDefaultValueAndSetter(String name, double defaultValue, Consumer<Double> setter) forIntWithNameAndDefaultValueAndSetter(String name, int defaultValue, Consumer<Integer> setter) forStringWithNameAndDefaultValueAndSetter(String name, String defaultValue, Consumer<String> setter) booleanisEmpty()voidSets the given value to the currentIValue.static <T> Value<T> withNameAndDefaultValueAndSetterAndValueMapperAndSpecificationMapper(String name, T defaultValue, Consumer<T> setter, Function<INode<?>, T> valueMapper, Function<T, INode<?>> specificationMapper) Methods inherited from class AbstractValue
addedOrChangedAttribute, getName, isMaterializedMethods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface EmptinessRequestable
containsAnyMethods inherited from interface INameHolder
getName, getNameInQuotes, hasName, hasSameNameAsMethods inherited from interface IProperty
addedOrChangedAttributeMethods inherited from interface MaterializationRequestable
isMaterialized, isView
-
Method Details
-
forBooleanWithNameAndDefaultValueAndSetter
public static Value<Boolean> forBooleanWithNameAndDefaultValueAndSetter(String name, boolean defaultValue, Consumer<Boolean> setter) - Parameters:
name-defaultValue-setter-- Returns:
- a new
Valuewith the given name, defaultValue and setter and that will store aBoolean. - 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
Valuewith the given name, defaultValue and setter and that will store aDouble. - 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
Valuewith the given name, defaultValue and setter and that will store aInteger. - 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
Valuewith the given name, defaultValue and setter and that will store aString. - 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 createdValue.- Parameters:
name-defaultValue-setter-valueMapper-specificationMapper-- Returns:
- a new
Valuewith 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
Fills up the attributes of the currentIPropertyinto the given list.- Specified by:
fillUpAttributesIntoListin interfaceIProperty- Parameters:
list-
-
getStoredValue
- Specified by:
getStoredValuein interfaceIValue<V>- Returns:
- the value of the current
IValue.
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceEmptinessRequestable- Returns:
- true if
EmptinessRequestabledoes not contain an element, false otherwise.
-
setValue
-