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 voidaccept(ExpressionVisitor visitor)Allows an expression visitor to visit this expression and it's sub-expressions (implements Visitor design pattern).protected static voidaddTypePair(Class clazz, Type operandType, Type resultType)Adds the type mapping for the given operand type and its expected result type for a operator.ExpressiongetOperandExpression()Gets the operand expression for this unary operatorTypegetReturnType()Gets the return type of the expression.voidinitialize(ExpressionContext expressionContext, Object parameters, boolean validate)Initializes the operand expression.StringtoString()voiduninitialize(ExpressionContext expressionContext)Uninitializes the unary operator expression.protected voidvalidate(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:
initializein 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:ExpressionGets the return type of the expression.- Specified by:
getReturnTypein 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:
uninitializein 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:
toStringin 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:
acceptin interfaceExpression- Parameters:
visitor- a visitor object that this expression must visit when accept is called.- See Also:
Expression.accept(org.vedantatree.expressionoasis.ExpressionVisitor)
-
-