Enum Class FormulaEvaluatorUtil

java.lang.Object
java.lang.Enum<FormulaEvaluatorUtil>
org.faktorips.runtime.formula.FormulaEvaluatorUtil
All Implemented Interfaces:
Serializable, Comparable<FormulaEvaluatorUtil>, Constable

public enum FormulaEvaluatorUtil extends 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:
  • Method Details

    • values

      public static FormulaEvaluatorUtil[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static FormulaEvaluatorUtil valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      NullPointerException - 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) IConfigurableModelObject in the list that is configured by a IProductComponent with the given ID, null if no such object is found in the list.
      Type Parameters:
      T - the type of IModelObject returned by this method and expected in the list
      Parameters:
      modelObjects - a list of model objects of type T
      id - the runtime ID this method searches
      Returns:
      the (first) IConfigurableModelObject in the list that is configured by a IProductComponent with the given ID, null if 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 all IConfigurableModelObject in the list that is configured by a IProductComponent with the given ID, the list is empty if no such object is found in the list.
      Type Parameters:
      T - the type of IModelObject returned by this method and expected in the list
      Parameters:
      modelObjects - a list of model objects of type T
      id - the runtime ID this method searches
      Returns:
      the all IConfigurableModelObject in the list that is configured by a IProductComponent with the given ID, the list is empty if no such object is found in the list
      See Also:
    • getModelObjectById

      public static <T extends IModelObject, R extends T> R getModelObjectById(T modelObject, String id)
      Returns the IModelObject if it is a IConfigurableModelObject configured by a IProductComponent with the given ID, null otherwise.
      Type Parameters:
      T - the type of IModelObject returned and expected by this method
      Parameters:
      modelObject - a model object of type T
      id - the runtime ID this method searches
      Returns:
      the IModelObject if it is a IConfigurableModelObject configured by a IProductComponent with the given ID, null otherwise
      See Also:
    • toPrimitiveBoolean

      public static boolean toPrimitiveBoolean(Boolean b)
      Returns the value of the Boolean object as a boolean primitive. If the Boolean object is null, false is returned.
      Returns:
      the primitive boolean value of the given Boolean.