Class ValueProperty<V>
java.lang.Object
ch.nolix.system.element.valueproperty.AbstractValueProperty<V>
ch.nolix.system.element.valueproperty.ValueProperty<V>
- Type Parameters:
V- the type of the value of aValueProperty.
- All Implemented Interfaces:
NameHolder, EmptinessRequestable, MaterializationRequestable, Property, BaseValueProperty, IValueProperty<V>
- Author:
- Silvan Wyss
-
Method Summary
Modifier and TypeMethodDescriptionvoidfillUpAttributesIntoList(ILinkedList<Node<?>> list) Fills up the attributes of the currentPropertyinto the given list.static ValueProperty<Boolean> forBooleanWithNameAndDefaultValueAndSetter(String name, boolean defaultValue, Consumer<Boolean> setter) static ValueProperty<Double> forDoubleWithNameAndDefaultValueAndSetter(String name, double defaultValue, Consumer<Double> setter) static <E extends Element>
ValueProperty<E> forElementWithNameAndDefaultValueAndSetterAndValueMapper(String name, E defaultValue, Consumer<E> setter, Function<Node<?>, E> valueMapper) static ValueProperty<Integer> forIntWithNameAndDefaultValueAndSetter(String name, int defaultValue, Consumer<Integer> setter) static ValueProperty<String> forStringWithNameAndDefaultValueAndSetter(String name, String defaultValue, Consumer<String> setter) booleanisEmpty()voidSets the given value to the currentIValueProperty.static <T> ValueProperty<T> withNameAndDefaultValueAndSetterAndValueMapperAndSpecificationMapper(String name, T defaultValue, Consumer<T> setter, Function<Node<?>, T> valueMapper, Function<T, Node<?>> specificationMapper) Methods inherited from class AbstractValueProperty
addedOrChangedAttribute, getName, isMaterializedMethods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface EmptinessRequestable
containsAnyMethods inherited from interface MaterializationRequestable
isMaterialized, isViewMethods inherited from interface NameHolder
getName, getNameInSingleQuotes, hasName, hasSameNameAsMethods inherited from interface Property
addedOrChangedAttribute
-
Method Details
-
forBooleanWithNameAndDefaultValueAndSetter
public static ValueProperty<Boolean> forBooleanWithNameAndDefaultValueAndSetter(String name, boolean defaultValue, Consumer<Boolean> setter) - Parameters:
name-defaultValue-setter-- Returns:
- a new
ValuePropertywith the given name, defaultValue and setter and that will store aBoolean - Throws:
RuntimeException- if the given name is nullRuntimeException- if the given name is blankRuntimeException- if the given setter is null
-
forDoubleWithNameAndDefaultValueAndSetter
public static ValueProperty<Double> forDoubleWithNameAndDefaultValueAndSetter(String name, double defaultValue, Consumer<Double> setter) - Parameters:
name-defaultValue-setter-- Returns:
- a new
ValuePropertywith the given name, defaultValue and setter and that will store aDouble - Throws:
RuntimeException- if the given name is nullRuntimeException- if the given name is blankRuntimeException- if the given setter is null
-
forElementWithNameAndDefaultValueAndSetterAndValueMapper
public static <E extends Element> ValueProperty<E> forElementWithNameAndDefaultValueAndSetterAndValueMapper(String name, E defaultValue, Consumer<E> setter, Function<Node<?>, E> valueMapper) - Type Parameters:
E- the type of the value of aValueProperty- Parameters:
name-defaultValue-setter-valueMapper-- Returns:
- a new
ValuePropertywith the given name, defaultValue, setter and valueMapper and and that can store aElement - Throws:
RuntimeException- if the given name is null or blankRuntimeException- if the given defaultValue is nullRuntimeException- if the given setter is nullRuntimeException- if the given valueMapper is null
-
forIntWithNameAndDefaultValueAndSetter
public static ValueProperty<Integer> forIntWithNameAndDefaultValueAndSetter(String name, int defaultValue, Consumer<Integer> setter) - Parameters:
name-defaultValue-setter-- Returns:
- a new
ValuePropertywith the given name, defaultValue and setter and that will store aInteger - Throws:
RuntimeException- if the given name is nullRuntimeException- if the given name is blankRuntimeException- if the given setter is null
-
forStringWithNameAndDefaultValueAndSetter
public static ValueProperty<String> forStringWithNameAndDefaultValueAndSetter(String name, String defaultValue, Consumer<String> setter) - Parameters:
name-defaultValue-setter-- Returns:
- a new
ValuePropertywith the given name, defaultValue and setter and that will store aString - Throws:
RuntimeException- if the given name is nullRuntimeException- if the given name is blankRuntimeException- if the given setter is null
-
withNameAndDefaultValueAndSetterAndValueMapperAndSpecificationMapper
public static <T> ValueProperty<T> withNameAndDefaultValueAndSetterAndValueMapperAndSpecificationMapper(String name, T defaultValue, Consumer<T> setter, Function<Node<?>, T> valueMapper, Function<T, Node<?>> specificationMapper) - Type Parameters:
T- the type of the value of the createdValueProperty- Parameters:
name-defaultValue-setter-valueMapper-specificationMapper-- Returns:
- a new
ValuePropertywith the given name, defaultValue, setter, valueMapper and specificationMapper - Throws:
RuntimeException- if the given name is null or blankRuntimeException- if the given defaultValue is nullRuntimeException- if the given setter is nullRuntimeException- if the given valueMapper is nullRuntimeException- if the given specificationMapper is null
-
fillUpAttributesIntoList
Fills up the attributes of the currentPropertyinto the given list.- Specified by:
fillUpAttributesIntoListin interfaceProperty- Parameters:
list-
-
getStoredValue
- Specified by:
getStoredValuein interfaceIValueProperty<V>- Returns:
- the value of the current
IValueProperty.
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceEmptinessRequestable- Returns:
- true if
EmptinessRequestabledoes not contain an element, false otherwise
-
setValue
Sets the given value to the currentIValueProperty.- Specified by:
setValuein interfaceIValueProperty<V>- Parameters:
value-
-