Class ValueChoiceCalculatorBase<T extends EObject,R>
java.lang.Object
tools.mdsd.library.emfeditutils.itempropertydescriptor.ValueChoiceCalculatorBase<T,R>
- Type Parameters:
T
- The type of object, for which the value choice shall be calculated.R
- The type of values.
- All Implemented Interfaces:
ValueChoiceCalculator
public abstract class ValueChoiceCalculatorBase<T extends EObject,R>
extends Object
implements ValueChoiceCalculator
Base class for type safe
ValueChoiceCalculator
implementations.-
Constructor Summary
ConstructorDescriptionValueChoiceCalculatorBase
(Class<T> objectType, Class<R> childType) Constructs the calculator. -
Method Summary
Modifier and TypeMethodDescriptionCollection<?>
getValueChoice
(Object object, Collection<?> originalChoice) Derives a list of value choices from a given list of available values and a given object.protected abstract Collection<?>
getValueChoiceTyped
(T object, List<R> typedList) Calculates a list of value choices for a given object and a given list of available values.
-
Constructor Details
-
ValueChoiceCalculatorBase
Constructs the calculator.- Parameters:
objectType
- The type of object, for which the value choice shall be calculated.childType
- The type of values.
-
-
Method Details
-
getValueChoice
Derives a list of value choices from a given list of available values and a given object. The method usually applies a filter on the given values but it is free to yield an arbitrary list of values. The implementation performs a type check of the given parameters and delegates the call togetValueChoiceTyped(EObject, List)
. If the type of the given object parameter does not match the defined object type passed to the constructor, the given list of choices will be returned. The set of values passed to the delegation method is filtered and casted to the value type passed to the constructor, keeping the null value in the list.- Specified by:
getValueChoice
in interfaceValueChoiceCalculator
- Parameters:
object
- The object for which the choice of values shall be calculated.originalChoice
- The set of available values to choose from.- Returns:
- A new set of values to choose from.
- See Also:
-
getValueChoiceTyped
Calculates a list of value choices for a given object and a given list of available values.- Parameters:
object
- The object to calculate the value selection for.typedList
- A list of available values.- Returns:
- The derived list of value choices.
-