Package org.faktorips.runtime.formula
Enum FormulaEvaluatorUtil
- All Implemented Interfaces:
Serializable,Comparable<FormulaEvaluatorUtil>,java.lang.constant.Constable
Provides methods that can be used in formula evaluation.
Some code in formulas does not need to be generated again and again but is implemented in static methods in this class that are used by the formulas.
- Since:
- 3.6
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classFormulaEvaluatorUtil.AssociationTo1Helper<S extends IModelObject,T extends IModelObject> Helper class for navigating 1-to-1 associations from a list of source objects of type<S>to target objects of type<T>.static classFormulaEvaluatorUtil.AssociationToManyHelper<S extends IModelObject,T extends IModelObject> Helper class for navigating 1-to-many associations from a list of source objects of type<S>to target objects of type<T>.static classHelper class to get the values from a list of source objects of type<S>to target type<E>.static classHelper class to encapsulate a function call to verify the existence of an object that could result in anException(for example aNullPointerExceptionorIndexOutOfBoundsExceptionwhen navigating over associations inmodel objects) which should just be treated as afalseresult.static classBase class for functions working on list arguments.Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends IModelObject,R extends T>
List<? extends R>getListModelObjectById(List<? extends T> modelObjects, String id) Returns allIConfigurableModelObjectin the list that is configured by aIProductComponentwith the given ID, the list is empty if no such object is found in the list.static <T extends IModelObject,R extends T>
RgetModelObjectById(List<? extends T> modelObjects, String id) Returns the (first)IConfigurableModelObjectin the list that is configured by aIProductComponentwith the given ID,nullif no such object is found in the list.static <T extends IModelObject,R extends T>
RgetModelObjectById(T modelObject, String id) Returns theIModelObjectif it is aIConfigurableModelObjectconfigured by aIProductComponentwith the given ID,nullotherwise.static booleanReturns the value of theBooleanobject as a boolean primitive.static FormulaEvaluatorUtilReturns the enum constant of this type with the specified name.static FormulaEvaluatorUtil[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
getModelObjectById
public static <T extends IModelObject,R extends T> R getModelObjectById(List<? extends T> modelObjects, String id) Returns the (first)IConfigurableModelObjectin the list that is configured by aIProductComponentwith the given ID,nullif no such object is found in the list.- Type Parameters:
T- the type ofIModelObjectreturned by this method and expected in the list- Parameters:
modelObjects- a list of model objects of type Tid- the runtime ID this method searches- Returns:
- the (first)
IConfigurableModelObjectin the list that is configured by aIProductComponentwith the given ID,nullif no such object is found in the list - See Also:
-
getListModelObjectById
public static <T extends IModelObject,R extends T> List<? extends R> getListModelObjectById(List<? extends T> modelObjects, String id) Returns allIConfigurableModelObjectin the list that is configured by aIProductComponentwith the given ID, the list is empty if no such object is found in the list.- Type Parameters:
T- the type ofIModelObjectreturned by this method and expected in the list- Parameters:
modelObjects- a list of model objects of type Tid- the runtime ID this method searches- Returns:
- the all
IConfigurableModelObjectin the list that is configured by aIProductComponentwith the given ID, the list is empty if no such object is found in the list - See Also:
-
getModelObjectById
Returns theIModelObjectif it is aIConfigurableModelObjectconfigured by aIProductComponentwith the given ID,nullotherwise.- Type Parameters:
T- the type ofIModelObjectreturned and expected by this method- Parameters:
modelObject- a model object of type Tid- the runtime ID this method searches- Returns:
- the
IModelObjectif it is aIConfigurableModelObjectconfigured by aIProductComponentwith the given ID,nullotherwise - See Also:
-
toPrimitiveBoolean
Returns the value of theBooleanobject as a boolean primitive. If theBooleanobject isnull,falseis returned.- Returns:
- the primitive
booleanvalue of the givenBoolean.
-