Class UnaryOperatorExpression
- java.lang.Object
-
- org.vedantatree.expressionoasis.expressions.UnaryOperatorExpression
-
- All Implemented Interfaces:
Expression
- Direct Known Subclasses:
BWComplementExpression
,FunctionExpression
,MinusExpression
,MulExpression
,NotExpression
,ParanthesisExpression
,PlusExpression
,SumExpression
,UnaryPropertyExpression
public abstract class UnaryOperatorExpression extends Object implements Expression
This class defines the abstract implementation of unary operator expression.
-
-
Constructor Summary
Constructors Constructor Description UnaryOperatorExpression()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(ExpressionVisitor visitor)
Allows an expression visitor to visit this expression and it's sub-expressions (implements Visitor design pattern).protected static void
addTypePair(Class clazz, Type operandType, Type resultType)
Adds the type mapping for the given operand type and its expected result type for a operator.Expression
getOperandExpression()
Gets the operand expression for this unary operatorType
getReturnType()
Gets the return type of the expression.void
initialize(ExpressionContext expressionContext, Object parameters, boolean validate)
Initializes the operand expression.String
toString()
void
uninitialize(ExpressionContext expressionContext)
Uninitializes the unary operator expression.protected void
validate(ExpressionContext expressionContext)
Validates the expression.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.vedantatree.expressionoasis.expressions.Expression
getValue
-
-
-
-
Method Detail
-
initialize
public void initialize(ExpressionContext expressionContext, Object parameters, boolean validate) throws ExpressionEngineException
Initializes the operand expression.- Specified by:
initialize
in interfaceExpression
- Parameters:
expressionContext
- contextual information, may help in initializationparameters
- for example, sub expressions and identifiers- Throws:
ExpressionEngineException
- if there is any problem during execution- See Also:
org.vedantatree.expressionoasis.expressions.Expression#initialize(org.vedantatree.expressionoasis.ExpressionContext, java.lang.Object)
-
getOperandExpression
public Expression getOperandExpression()
Gets the operand expression for this unary operator- Returns:
- Returns the operandExpression.
-
getReturnType
public Type getReturnType() throws ExpressionEngineException
Description copied from interface:Expression
Gets the return type of the expression.- Specified by:
getReturnType
in interfaceExpression
- Returns:
- the type of expression
- Throws:
ExpressionEngineException
- If there is any problem during execution- See Also:
Expression.getReturnType()
-
uninitialize
public void uninitialize(ExpressionContext expressionContext)
Uninitializes the unary operator expression.- Specified by:
uninitialize
in interfaceExpression
- Parameters:
expressionContext
- contextual information, may help in un-initialization- See Also:
Expression.uninitialize(org.vedantatree.expressionoasis.ExpressionContext)
-
validate
protected void validate(ExpressionContext expressionContext) throws ExpressionEngineException
Validates the expression.- Parameters:
expressionContext
-- Throws:
ExpressionEngineException
-
addTypePair
protected static final void addTypePair(Class clazz, Type operandType, Type resultType)
Adds the type mapping for the given operand type and its expected result type for a operator.- Parameters:
clazz
- class of the operatoroperandType
- type of operandresultType
- type of the result
-
toString
public String toString()
- Overrides:
toString
in classObject
- See Also:
Object.toString()
-
accept
public void accept(ExpressionVisitor visitor)
Allows an expression visitor to visit this expression and it's sub-expressions (implements Visitor design pattern).- Specified by:
accept
in interfaceExpression
- Parameters:
visitor
- a visitor object that this expression must visit when accept is called.- See Also:
Expression.accept(org.vedantatree.expressionoasis.ExpressionVisitor)
-
-