Package org.mvel2.compiler
Class PropertyVerifier
- java.lang.Object
-
- org.mvel2.compiler.AbstractParser
-
- org.mvel2.optimizers.AbstractOptimizer
-
- org.mvel2.compiler.PropertyVerifier
-
- All Implemented Interfaces:
java.io.Serializable
,Parser
public class PropertyVerifier extends AbstractOptimizer
This verifier is used by the compiler to enforce rules such as type strictness. It is, as side-effect, also responsible for extracting type information.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
classLiteral
private static int
COL
private java.lang.Class
ctx
private boolean
deepProperty
private static int
DONE
private boolean
first
private boolean
fqcn
private java.util.List<java.lang.String>
inputs
private static int
METH
private boolean
methodCall
private static int
NORM
private java.util.Map<java.lang.String,java.lang.reflect.Type>
paramTypes
private boolean
resolvedExternally
private static int
WITH
-
Fields inherited from class org.mvel2.optimizers.AbstractOptimizer
BEAN, collection, currType, nullSafe, staticAccess, tkStart
-
Fields inherited from class org.mvel2.compiler.AbstractParser
CLASS_LITERALS, compileMode, cursor, debugSymbols, dStack, end, expr, fields, GET, GET_OR_CREATE, greedy, lastLineStart, lastNode, lastWasComment, lastWasIdentifier, lastWasLineLabel, length, LEVEL_0_PROPERTY_ONLY, LEVEL_1_BASIC_LANG, LEVEL_2_MULTI_STATEMENT, LEVEL_3_ITERATION, LEVEL_4_ASSIGNMENT, LEVEL_5_CONTROL_FLOW, line, literalOnly, LITERALS, OP_CONTINUE, OP_NOT_LITERAL, OP_OVERFLOW, OP_RESET_FRAME, OP_TERMINATE, OPERATORS, pCtx, REMOVE, SET, splitAccumulator, st, start, stk, variableFactory
-
-
Constructor Summary
Constructors Constructor Description PropertyVerifier(char[] property, int start, int offset, ParserContext parserContext)
PropertyVerifier(char[] property, ParserContext parserContext)
PropertyVerifier(java.lang.String property, ParserContext parserContext)
PropertyVerifier(java.lang.String property, ParserContext parserContext, java.lang.Class root)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Class
analyze()
Analyze the statement and return the known egress type.private java.lang.Class
getBeanProperty(java.lang.Class ctx, java.lang.String property)
Process bean propertyprivate java.lang.Class
getCollectionProperty(java.lang.Class ctx, java.lang.String property)
Process collection propertyjava.lang.Class
getCtx()
java.util.List<java.lang.String>
getInputs()
private java.lang.Class
getMethod(java.lang.Class ctx, java.lang.String name)
Process methodprivate java.lang.Class
getReturnType(java.lang.Class context, java.lang.reflect.Method m)
private java.lang.Class
getWithProperty(java.lang.Class ctx)
boolean
isClassLiteral()
boolean
isDeepProperty()
boolean
isFqcn()
boolean
isInput()
boolean
isMethodCall()
boolean
isResolvedExternally()
private void
recordParametricReturnedType(java.lang.reflect.Type parametricReturnType)
private void
recordTypeParmsForProperty(java.lang.String property)
private java.lang.Class<?>
returnGenericType(java.lang.reflect.Method m)
void
setCtx(java.lang.Class ctx)
void
setInputs(java.util.List<java.lang.String> inputs)
private static java.lang.Class<?>
type2Class(java.lang.reflect.Type type)
-
Methods inherited from class org.mvel2.optimizers.AbstractOptimizer
capture, findLastUnion, nextSubToken, scanTo, tryStaticAccess, whiteSpaceSkip
-
Methods inherited from class org.mvel2.compiler.AbstractParser
addFatalError, addFatalError, arithmeticFunctionReduction, captureIdentifier, captureToEOS, captureToEOSorEOL, captureToEOT, captureToNextTokenJunction, expectEOS, expectNextChar_IW, getCursor, getExpression, handleSubstatement, handleUnion, ifThenElseBlockContinues, incNextNonBlank, isArithmeticOperator, isNextIdentifier, isNextIdentifierOrLiteral, isStatementNotManuallyTerminated, lastNonWhite, loadLanguageFeaturesByLevel, lookAhead, lookAhead, lookBehind, lookToLast, nextNonBlank, nextToken, nextTokenSkipSymbols, reduce, setExpression, setExpression, setLanguageLevel, setupParser, skipWhitespace, tokenContinues, trimLeft, trimRight, trimWhitespace
-
-
-
-
Field Detail
-
DONE
private static final int DONE
- See Also:
- Constant Field Values
-
NORM
private static final int NORM
- See Also:
- Constant Field Values
-
METH
private static final int METH
- See Also:
- Constant Field Values
-
COL
private static final int COL
- See Also:
- Constant Field Values
-
WITH
private static final int WITH
- See Also:
- Constant Field Values
-
inputs
private java.util.List<java.lang.String> inputs
-
first
private boolean first
-
classLiteral
private boolean classLiteral
-
resolvedExternally
private boolean resolvedExternally
-
methodCall
private boolean methodCall
-
deepProperty
private boolean deepProperty
-
fqcn
private boolean fqcn
-
paramTypes
private java.util.Map<java.lang.String,java.lang.reflect.Type> paramTypes
-
ctx
private java.lang.Class ctx
-
-
Constructor Detail
-
PropertyVerifier
public PropertyVerifier(char[] property, ParserContext parserContext)
-
PropertyVerifier
public PropertyVerifier(char[] property, int start, int offset, ParserContext parserContext)
-
PropertyVerifier
public PropertyVerifier(java.lang.String property, ParserContext parserContext)
-
PropertyVerifier
public PropertyVerifier(java.lang.String property, ParserContext parserContext, java.lang.Class root)
-
-
Method Detail
-
getInputs
public java.util.List<java.lang.String> getInputs()
-
setInputs
public void setInputs(java.util.List<java.lang.String> inputs)
-
analyze
public java.lang.Class analyze()
Analyze the statement and return the known egress type.- Returns:
- known engress type
-
recordTypeParmsForProperty
private void recordTypeParmsForProperty(java.lang.String property)
-
getBeanProperty
private java.lang.Class getBeanProperty(java.lang.Class ctx, java.lang.String property)
Process bean property- Parameters:
ctx
- - the ingress typeproperty
- - the property component- Returns:
- known egress type.
-
getReturnType
private java.lang.Class getReturnType(java.lang.Class context, java.lang.reflect.Method m)
-
recordParametricReturnedType
private void recordParametricReturnedType(java.lang.reflect.Type parametricReturnType)
-
returnGenericType
private java.lang.Class<?> returnGenericType(java.lang.reflect.Method m)
-
getCollectionProperty
private java.lang.Class getCollectionProperty(java.lang.Class ctx, java.lang.String property)
Process collection property- Parameters:
ctx
- - the ingress typeproperty
- - the property component- Returns:
- known egress type
-
getMethod
private java.lang.Class getMethod(java.lang.Class ctx, java.lang.String name)
Process method- Parameters:
ctx
- - the ingress typename
- - the property component- Returns:
- known egress type.
-
type2Class
private static java.lang.Class<?> type2Class(java.lang.reflect.Type type)
-
getWithProperty
private java.lang.Class getWithProperty(java.lang.Class ctx)
-
isResolvedExternally
public boolean isResolvedExternally()
-
isClassLiteral
public boolean isClassLiteral()
-
isDeepProperty
public boolean isDeepProperty()
-
isInput
public boolean isInput()
-
isMethodCall
public boolean isMethodCall()
-
isFqcn
public boolean isFqcn()
-
getCtx
public java.lang.Class getCtx()
-
setCtx
public void setCtx(java.lang.Class ctx)
-
-