Package org.faktorips.runtime.formula
Enum FormulaEvaluatorUtil
- java.lang.Object
-
- java.lang.Enum<FormulaEvaluatorUtil>
-
- org.faktorips.runtime.formula.FormulaEvaluatorUtil
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<FormulaEvaluatorUtil>
public enum FormulaEvaluatorUtil extends java.lang.Enum<FormulaEvaluatorUtil>
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:
IFormulaEvaluator
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static 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 classFormulaEvaluatorUtil.AttributeAccessorHelper<S extends IModelObject,E>Helper class to get the values from a list of source objects of type<S>to target type<E>.static classFormulaEvaluatorUtil.ExistsHelperHelper 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 classFormulaEvaluatorUtil.FunctionWithListAsArgumentHelper<E>Base class for functions working on list arguments.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends IModelObject,R extends T>
java.util.List<? extends R>getListModelObjectById(java.util.List<? extends T> modelObjects, java.lang.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(java.util.List<? extends T> modelObjects, java.lang.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, java.lang.String id)Returns theIModelObjectif it is aIConfigurableModelObjectconfigured by aIProductComponentwith the given ID,nullotherwise.static booleantoPrimitiveBoolean(java.lang.Boolean b)Returns the value of theBooleanobject as a boolean primitive.static FormulaEvaluatorUtilvalueOf(java.lang.String name)Returns 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 Detail
-
values
public static FormulaEvaluatorUtil[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (FormulaEvaluatorUtil c : FormulaEvaluatorUtil.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static FormulaEvaluatorUtil valueOf(java.lang.String name)
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:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
getModelObjectById
public static <T extends IModelObject,R extends T> R getModelObjectById(java.util.List<? extends T> modelObjects, java.lang.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:
getModelObjectById(IModelObject, String)
-
getListModelObjectById
public static <T extends IModelObject,R extends T> java.util.List<? extends R> getListModelObjectById(java.util.List<? extends T> modelObjects, java.lang.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(IModelObject, String)
-
getModelObjectById
public static <T extends IModelObject,R extends T> R getModelObjectById(T modelObject, java.lang.String id)
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:
getModelObjectById(List, String)
-
toPrimitiveBoolean
public static boolean toPrimitiveBoolean(java.lang.Boolean b)
Returns the value of theBooleanobject as a boolean primitive. If theBooleanobject isnull,falseis returned.- Returns:
- the primitive
booleanvalue of the givenBoolean.
-
-