public class JavaExpressionParseUtil extends Object
| Modifier and Type | Class and Description | 
|---|---|
| static class  | JavaExpressionParseUtil.JavaExpressionParseExceptionAn exception that indicates a parse error. | 
| Modifier and Type | Field and Description | 
|---|---|
| protected static Pattern | ANCHORED_PARAMETER_PATTERNAnchored pattern for a formal parameter use; matches a string that is exactly a formal
 parameter use. | 
| protected static String | PARAMETER_REGEXRegular expression for a formal parameter use. | 
| protected static Pattern | UNANCHORED_PARAMETER_PATTERNUnanchored pattern for a formal parameter use; can be used to find all formal parameter uses. | 
| Constructor and Description | 
|---|
| JavaExpressionParseUtil() | 
| Modifier and Type | Method and Description | 
|---|---|
| static int | parameterIndex(String s)If  sis exactly a formal parameter, return its 1-based index. | 
| static JavaExpression | parse(String expression,
     TypeMirror enclosingType,
     @Nullable ThisReference thisReference,
     @Nullable List<FormalParameter> parameters,
     @Nullable TreePath localVarPath,
     TreePath pathToCompilationUnit,
     ProcessingEnvironment env)Parses a string to a  JavaExpression. | 
protected static final String PARAMETER_REGEX
protected static final Pattern ANCHORED_PARAMETER_PATTERN
protected static final Pattern UNANCHORED_PARAMETER_PATTERN
public static JavaExpression parse(String expression, TypeMirror enclosingType, @Nullable ThisReference thisReference, @Nullable List<FormalParameter> parameters, @Nullable TreePath localVarPath, TreePath pathToCompilationUnit, ProcessingEnvironment env) throws JavaExpressionParseUtil.JavaExpressionParseException
JavaExpression.
 For most uses, clients should call one of the static methods in StringToJavaExpression rather than calling this method directly.
expression - the string expression to parseenclosingType - type of the class that encloses the JavaExpressionthisReference - the JavaExpression to which to parse "this", or null if "this" should not
     appear in the expressionparameters - list of JavaExpressions to which to parse formal parameter references such as
     "#2", or null if formal parameter references should not appear in the expressionlocalVarPath - if non-null, the expression is parsed as if it were written at this
     location; affects only parsing of local variablespathToCompilationUnit - required to use the underlying Javac APIenv - the processing environmentexpression as a JavaExpressionJavaExpressionParseUtil.JavaExpressionParseException - if the string cannot be parsedpublic static int parameterIndex(String s)
s is exactly a formal parameter, return its 1-based index. Returns -1 otherwise.s - a Java expressions represents, or -1