Class ValueChoiceCalculatorBase<T extends EObject,​R>

    • Constructor Detail

      • ValueChoiceCalculatorBase

        public ValueChoiceCalculatorBase​(Class<T> objectType,
                                         Class<R> childType)
        Constructs the calculator.
        Parameters:
        objectType - The type of object, for which the value choice shall be calculated.
        childType - The type of values.
    • Method Detail

      • getValueChoice

        public Collection<?> getValueChoice​(Object object,
                                            Collection<?> originalChoice)
        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 to getValueChoiceTyped(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 interface ValueChoiceCalculator
        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:
        ValueChoiceCalculator.getValueChoice(Object, Collection)
      • getValueChoiceTyped

        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.
        Parameters:
        object - The object to calculate the value selection for.
        typedList - A list of available values.
        Returns:
        The derived list of value choices.