Class ExpressionOasisHelper
- java.lang.Object
-
- de.fzi.power.interpreter.calculator.expressionoasis.helper.ExpressionOasisHelper
-
public final class ExpressionOasisHelper extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidassertCorrectExpressionContext(ExpressionContext expressionContext, Class<?> assertingClass)Asserts that the given expression context instance is aCustomExpressionContextinstance.static booleanhasCompositeType(ValueObject valueObject)Gets whether the given value object has a composite type.static booleanhasNumericType(ValueObject valueObject)Gets whether the given value object has a numeric type.
This method call is equivalent to (in case no exception occurs) callingisNumericType(valueObject.getValueType()).static booleanisNumericType(Type type)Gets whether the given type is numeric.static booleantypesEqual(Type first, Type second)Convenience method to check whether the given two type instances are equal.
-
-
-
Method Detail
-
hasNumericType
public static boolean hasNumericType(ValueObject valueObject)
Gets whether the given value object has a numeric type.
This method call is equivalent to (in case no exception occurs) callingisNumericType(valueObject.getValueType()).- Parameters:
valueObject- AValueObject.- Returns:
trueif the given value object has a numeric type,falseotherwise.- Throws:
NullPointerException- In case the passed value object isnull.- See Also:
isNumericType(Type)
-
isNumericType
public static boolean isNumericType(Type type)
Gets whether the given type is numeric.- Parameters:
type- TheTypeinstance to check- Returns:
trueif the passed type is equal toType#Double,Type.INTEGER,Type.LONG,Type.FLOAT,Type.SHORTorType.BYTE.- Throws:
NullPointerException- In case the passed type isnull.
-
typesEqual
public static boolean typesEqual(Type first, Type second)
Convenience method to check whether the given two type instances are equal.- Parameters:
first- ATypeinstance.second- ATypeinstance.- Returns:
trueif both type instances are equal, otherwisefalse.- Throws:
NullPointerException- In case either of the passed types isnull.
-
hasCompositeType
public static boolean hasCompositeType(ValueObject valueObject)
Gets whether the given value object has a composite type.- Parameters:
valueObject- AValueObjectinstance.- Returns:
trueiff the given value object is aMeasuredValuesCompositeValueObjectinstance,falseotherwise.- Throws:
NullPointerException- In case the passed value object isnull.
-
assertCorrectExpressionContext
public static void assertCorrectExpressionContext(ExpressionContext expressionContext, Class<?> assertingClass)
Asserts that the given expression context instance is aCustomExpressionContextinstance.- Parameters:
expressionContext- TheExpressionContextto check.assertingClass- TheClassof the object which is calling this method.
This parameter is only used to construct a message if the passed expression context has the wrong type.- Throws:
AssertionError- In case the given expression context is not aCustomExpressionContextinstance.
-
-