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 void
assertCorrectExpressionContext(ExpressionContext expressionContext, Class<?> assertingClass)
Asserts that the given expression context instance is aCustomExpressionContext
instance.static boolean
hasCompositeType(ValueObject valueObject)
Gets whether the given value object has a composite type.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())
.static boolean
isNumericType(Type type)
Gets whether the given type is numeric.static boolean
typesEqual(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:
true
if the given value object has a numeric type,false
otherwise.- 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
- TheType
instance to check- Returns:
true
if the passed type is equal toType#Double
,Type.INTEGER
,Type.LONG
,Type.FLOAT
,Type.SHORT
orType.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
- AType
instance.second
- AType
instance.- Returns:
true
if 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
- AValueObject
instance.- Returns:
true
iff the given value object is aMeasuredValuesCompositeValueObject
instance,false
otherwise.- 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 aCustomExpressionContext
instance.- Parameters:
expressionContext
- TheExpressionContext
to check.assertingClass
- TheClass
of 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 aCustomExpressionContext
instance.
-
-