Class MultiValueProperty<V>
java.lang.Object
ch.nolix.system.element.valueproperty.AbstractValueProperty<V>
ch.nolix.system.element.valueproperty.MultiValueProperty<V>
- Type Parameters:
V- the type of the values of aMultiValueProperty.
- All Implemented Interfaces:
NameHolder, Clearable, EmptinessRequestable, MaterializationRequestable, Property, BaseValueProperty, IMultiValueProperty<V>
public final class MultiValueProperty<V>
extends AbstractValueProperty<V>
implements IMultiValueProperty<V>
- Author:
- Silvan Wyss
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the given value to the currentIMultiValueProperty.voidclear()Removes the elements of the currentClearable.voidfillUpAttributesIntoList(ILinkedList<Node<?>> list) Fills up the attributes of the currentPropertyinto the given list.static <E extends Element>
MultiValueProperty<E> forElementsOfSameTypeWithNameAndAdderAndValueMapper(String name, Consumer<E> adder, Function<Node<?>, E> valueMapper) static <E extends Element>
MultiValueProperty<E> forElementsWithNameAndAdderAndValueMapper(String name, Consumer<E> adder, Function<Node<?>, E> valueMapper) static MultiValueProperty<Integer> forIntsWithNameAndAdder(String name, Consumer<Integer> adder) static MultiValueProperty<String> forStringsWithNameAndAdder(String name, Consumer<String> adder) booleanisEmpty()voidremoveAllOccurrencesOfValue(V value) Removes all occurrences of the given value from the currentIMultiValueProperty.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
-
forElementsOfSameTypeWithNameAndAdderAndValueMapper
public static <E extends Element> MultiValueProperty<E> forElementsOfSameTypeWithNameAndAdderAndValueMapper(String name, Consumer<E> adder, Function<Node<?>, E> valueMapper) - Type Parameters:
E- the type of the values of aMultiValueProperty- Parameters:
name-adder-valueMapper-- Returns:
- a new
MultiValuePropertywith the given name, adder and valueMapper that can storeElements - Throws:
RuntimeException- if the given name is null or blankRuntimeException- if the given adder is nullRuntimeException- if the given valueMapper is null
-
forElementsWithNameAndAdderAndValueMapper
public static <E extends Element> MultiValueProperty<E> forElementsWithNameAndAdderAndValueMapper(String name, Consumer<E> adder, Function<Node<?>, E> valueMapper) - Type Parameters:
E- the type of the values of aMultiValueProperty- Parameters:
name-adder-valueMapper-- Returns:
- a new
MultiValuePropertywith the given name, adder and valueMapper that can storeElements - Throws:
RuntimeException- if the given name is null or blankRuntimeException- if the given adder is nullRuntimeException- if the given valueMapper is null
-
forIntsWithNameAndAdder
public static MultiValueProperty<Integer> forIntsWithNameAndAdder(String name, Consumer<Integer> adder) - Parameters:
name-adder-- Returns:
- a new
MultiValuePropertywith the given name and adder and that can storeIntegers - Throws:
RuntimeException- if the given name is null or blankRuntimeException- if the given adder is null
-
forStringsWithNameAndAdder
public static MultiValueProperty<String> forStringsWithNameAndAdder(String name, Consumer<String> adder) - Parameters:
name-adder-- Returns:
- a new
MultiValuePropertywith the given name and adder and that can storeStrings - Throws:
RuntimeException- if the given name is null or blankRuntimeException- if the given adder is null
-
addValue
Adds the given value to the currentIMultiValueProperty.- Specified by:
addValuein interfaceIMultiValueProperty<V>- Parameters:
value-
-
clear
-
fillUpAttributesIntoList
Fills up the attributes of the currentPropertyinto the given list.- Specified by:
fillUpAttributesIntoListin interfaceProperty- Parameters:
list-
-
getStoredValues
- Specified by:
getStoredValuesin interfaceIMultiValueProperty<V>- Returns:
- the values of the current
IMultiValueProperty.
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceEmptinessRequestable- Returns:
- true if
EmptinessRequestabledoes not contain an element, false otherwise
-
removeAllOccurrencesOfValue
Removes all occurrences of the given value from the currentIMultiValueProperty.- Specified by:
removeAllOccurrencesOfValuein interfaceIMultiValueProperty<V>- Parameters:
value-
-