com.wewebu.expression.language
Class OwExprValue

java.lang.Object
  extended by com.wewebu.expression.language.OwExprValue
All Implemented Interfaces:
OwExprScope
Direct Known Subclasses:
OwExprBooleanValue, OwExprDateValue, OwExprNullValue, OwExprNumericValue, OwExprScopeValue, OwExprStringValue, OwExprTimeValue

public abstract class OwExprValue
extends Object
implements OwExprScope

A value is an expression evaluation result.
All values are scopes. Values are ''visitable'' by binary operator objects (see Visitor pattern) in a 2 stage visitor pattern implementation (first left side operand is visited than right side operand is visited thus selecting a typed operation evaluation in the operator class) Values are ''visitable'' by binary operator objects (see Visitor pattern) in a 1 stage visitor implementation.

Alfresco Workdesk
Copyright (c) Alfresco Software, Inc.
All rights reserved.

For licensing information read the license.txt file or
go to: http://wiki.alfresco.com


Constructor Summary
OwExprValue(Class javaType_p)
           
 
Method Summary
 OwExprValue accept(OwExprBinaryOperator binaryOperator_p, OwExprBooleanValue v1_p)
          Stage 2 binary operator visitor acceptance method
 OwExprValue accept(OwExprBinaryOperator binaryOperator_p, OwExprDateValue v1_p)
          Stage 2 binary operator visitor acceptance method
 OwExprValue accept(OwExprBinaryOperator binaryOperator_p, OwExprNumericValue v1_p)
          Stage 2 binary operator visitor acceptance method
 OwExprValue accept(OwExprBinaryOperator binaryOperator_p, OwExprScopeValue v1_p)
          Stage 2 binary operator visitor acceptance method
 OwExprValue accept(OwExprBinaryOperator binaryOperator_p, OwExprStringValue v1_p)
          Stage 2 binary operator visitor acceptance method
 OwExprValue accept(OwExprBinaryOperator binaryOperator_p, OwExprTimeValue v1_p)
          Stage 2 binary operator visitor acceptance method
 OwExprValue accept(OwExprBinaryOperator binaryOperator_p, OwExprValue v2_p)
          Stage 1 binary operator visitor acceptance method
 OwExprValue accept(OwExprUnaryOperator unaryOperator_p)
          Unary operator visitor acceptance method
 OwExprProperty at(int index_p)
          Indexed scope access method
static OwExprValue fromJavaValue(Object javaValue_p)
          Static expression language value factory based on a java object.
static OwExprValue fromJavaValue(Object javaValue_p, Class<?> javaType_p)
          Static expression language value factory based on a java object.
 OwExprFunction function(String functionName_p, OwExprExpressionType[] argunmentTypes_p)
          Scope OwExprScope.function(String, OwExprExpressionType[]) default implementation.
 Class<?> getJavaType()
           
protected  Map getValuePropeties()
          Overridable default value properties factory method
 boolean hasProperty(String propertyName_p)
          Scope OwExprScope.hasProperty(String) default implementation.
 int length()
          Scope OwExprScope.length() helper default value implementation (returns 0).
 OwExprProperty property(String propertyName_p)
          Scope OwExprScope.property(String) default implementation.
abstract  Object toJavaObject(Class javaSuperType_p)
          Java class conversion method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OwExprValue

public OwExprValue(Class javaType_p)
Parameters:
javaType_p - original java type
Since:
1.3.0 and AWD 3.1.0
Method Detail

fromJavaValue

public static final OwExprValue fromJavaValue(Object javaValue_p)
                                       throws OwExprEvaluationException
Static expression language value factory based on a java object.
Expression Type Java Peer Type
OwExprNumericValue java.lang.Number
OwExprStringValue java.lang.String
OwExprBooleanValue java.lang.Boolean
OwExprTimeValue OwExprTime
OwExprDateValue java.util.Calendar
OwExprNullValue Java's null literal type
If javaValue_p's type does not match any of the previous table entries a OwExprScopeValue will be factored.

Parameters:
javaValue_p - an object to be converted into its expression language value peer
Returns:
an expression language value based on javaValue_p
Throws:
OwExprEvaluationException

fromJavaValue

public static final OwExprValue fromJavaValue(Object javaValue_p,
                                              Class<?> javaType_p)
                                       throws OwExprEvaluationException
Static expression language value factory based on a java object.
Expression Type Java Peer Type
OwExprNumericValue java.lang.Number
OwExprStringValue java.lang.String
OwExprBooleanValue java.lang.Boolean
OwExprTimeValue OwExprTime
OwExprDateValue java.util.Calendar
OwExprNullValue Java's null literal type
If javaValue_p's type does not match any of the previous table entries a OwExprScopeValue will be factored.

Parameters:
javaValue_p - an object to be converted into its expression language value peer
javaType_p - original java type
Returns:
an expression language value based on javaValue_p
Throws:
OwExprEvaluationException
Since:
1.3.0 and AWD 3.1.0

toJavaObject

public abstract Object toJavaObject(Class javaSuperType_p)
                             throws OwExprEvaluationException
Java class conversion method.

Parameters:
javaSuperType_p - the requested java super type The returned type should be a subclass of this type. This is necessary for values having more than one possible java peers such as OwExprNumericValue's Integer and Double support.
Returns:
the java class peer of this value's expression language type
Throws:
OwExprEvaluationException

accept

public OwExprValue accept(OwExprBinaryOperator binaryOperator_p,
                          OwExprValue v2_p)
                   throws OwExprEvaluationException
Stage 1 binary operator visitor acceptance method

Parameters:
binaryOperator_p - binary operator visitor
v2_p - right side operator value
Returns:
the operator visit processed OwExprValue
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

accept

public OwExprValue accept(OwExprBinaryOperator binaryOperator_p,
                          OwExprBooleanValue v1_p)
                   throws OwExprEvaluationException
Stage 2 binary operator visitor acceptance method

Parameters:
binaryOperator_p - binary operator visitor
v1_p - lef side operator value
Returns:
the operator visit processed OwExprValue
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

accept

public OwExprValue accept(OwExprBinaryOperator binaryOperator_p,
                          OwExprNumericValue v1_p)
                   throws OwExprEvaluationException
Stage 2 binary operator visitor acceptance method

Parameters:
binaryOperator_p - binary operator visitor
v1_p - lef side operator value
Returns:
the operator visit processed OwExprValue
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

accept

public OwExprValue accept(OwExprBinaryOperator binaryOperator_p,
                          OwExprStringValue v1_p)
                   throws OwExprEvaluationException
Stage 2 binary operator visitor acceptance method

Parameters:
binaryOperator_p - binary operator visitor
v1_p - lef side operator value
Returns:
the operator visit processed OwExprValue
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

accept

public OwExprValue accept(OwExprBinaryOperator binaryOperator_p,
                          OwExprDateValue v1_p)
                   throws OwExprEvaluationException
Stage 2 binary operator visitor acceptance method

Parameters:
binaryOperator_p - binary operator visitor
v1_p - lef side operator value
Returns:
the operator visit processed OwExprValue
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

accept

public OwExprValue accept(OwExprBinaryOperator binaryOperator_p,
                          OwExprTimeValue v1_p)
                   throws OwExprEvaluationException
Stage 2 binary operator visitor acceptance method

Parameters:
binaryOperator_p - binary operator visitor
v1_p - lef side operator value
Returns:
the operator visit processed OwExprValue
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

accept

public OwExprValue accept(OwExprBinaryOperator binaryOperator_p,
                          OwExprScopeValue v1_p)
                   throws OwExprEvaluationException
Stage 2 binary operator visitor acceptance method

Parameters:
binaryOperator_p - binary operator visitor
v1_p - lef side operator value
Returns:
the operator visit processed OwExprValue
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

accept

public OwExprValue accept(OwExprUnaryOperator unaryOperator_p)
                   throws OwExprEvaluationException
Unary operator visitor acceptance method

Parameters:
unaryOperator_p - binary operator visitor
Returns:
the operator visit processed OwExprValue
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

function

public OwExprFunction function(String functionName_p,
                               OwExprExpressionType[] argunmentTypes_p)
                        throws OwExprEvaluationException
Scope OwExprScope.function(String, OwExprExpressionType[]) default implementation. By default value-scopes have no functions defined

Specified by:
function in interface OwExprScope
Parameters:
functionName_p - the requested function name
argunmentTypes_p - array of OwExprExpressionType that defines the argument signature of the requested function
Returns:
the OwExprProperty designated by propertyName_p and found in this value's scope
Throws:
OwExprEvaluationException - if the requested property is not found in this scope or the creation of the corresponding OwExprProperty has failed

at

public OwExprProperty at(int index_p)
                  throws OwExprEvaluationException
Indexed scope access method

Specified by:
at in interface OwExprScope
Parameters:
index_p - int index of the requested property
Returns:
the method always throws an exception
Throws:
OwExprEvaluationException - always as no indexed access is supported on value scopes

length

public int length()
           throws OwExprEvaluationException
Scope OwExprScope.length() helper default value implementation (returns 0).

Specified by:
length in interface OwExprScope
Returns:
always 0
Throws:
OwExprEvaluationException

getValuePropeties

protected Map getValuePropeties()
Overridable default value properties factory method

Returns:
a Map of OwExprProperty for this value

property

public OwExprProperty property(String propertyName_p)
                        throws OwExprEvaluationException
Scope OwExprScope.property(String) default implementation. A default value properties mechanism is implemented. Concrete values must create properties via getValuePropeties().

Specified by:
property in interface OwExprScope
Parameters:
propertyName_p - the requested property name
Returns:
the OwExprProperty designated by propertyName_p and found in this value's scope
Throws:
OwExprEvaluationException - if the requested property is not found in this scope or the creation of the corresponding OwExprProperty has failed

hasProperty

public boolean hasProperty(String propertyName_p)
                    throws OwExprEvaluationException
Scope OwExprScope.hasProperty(String) default implementation. A default value properties mechanism is implemented. Concrete values must create properties via getValuePropeties().

Specified by:
hasProperty in interface OwExprScope
Parameters:
propertyName_p - the requested property name
Returns:
true if this scope can perform property access for the requested property - an access via property(String) will NOT fail on missing property grounds, false otherwise
Throws:
OwExprEvaluationException - if the property validity check has failed

getJavaType

public final Class<?> getJavaType()
Returns:
the original java type
Since:
1.3.0 and AWD 3.1.0


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.