public final class MvelParser extends Object
Constructor and Description |
---|
MvelParser()
Instantiate the parser with default configuration.
|
MvelParser(com.github.javaparser.ParserConfiguration configuration)
Instantiate the parser.
|
Modifier and Type | Method and Description |
---|---|
com.github.javaparser.ParserConfiguration |
getParserConfiguration()
Get the non-static configuration for this parser.
|
static com.github.javaparser.ParserConfiguration |
getStaticConfiguration()
Get the configuration for the static parse... methods.
|
static com.github.javaparser.ast.expr.Expression |
parse(InputStream in)
Parses the Java code contained in the
InputStream and returns a
Expression that represents it. |
static com.github.javaparser.ast.expr.Expression |
parse(InputStream in,
Charset encoding)
Parses the Java code contained in the
InputStream and returns a
Expression that represents it. |
<N extends com.github.javaparser.ast.Node> |
parse(ParseStart<N> start,
Provider provider)
Parses source code.
|
static com.github.javaparser.ast.expr.Expression |
parse(Reader reader)
Parses Java code from a Reader and returns a
Expression that represents it. |
static com.github.javaparser.ast.expr.Expression |
parse(String code)
Parses the Java code contained in code and returns a
Expression that represents it. |
static com.github.javaparser.ast.stmt.BlockStmt |
parseBlock(String blockStatement)
Parses the Java block contained in a
String and returns a
BlockStmt that represents it. |
static com.github.javaparser.ast.type.ClassOrInterfaceType |
parseClassOrInterfaceType(String type)
Parses a Java class or interface type name and returns a
ClassOrInterfaceType that represents it. |
static com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt |
parseExplicitConstructorInvocationStmt(String statement)
Parses the this(...) and super(...) statements that may occur at the start of a constructor.
|
static <T extends com.github.javaparser.ast.expr.Expression> |
parseExpression(String expression)
Parses the Java expression contained in a
String and returns a
Expression that represents it. |
static com.github.javaparser.ast.expr.Name |
parseName(String qualifiedName)
Parses a qualified name (one that can have "."
|
static com.github.javaparser.ast.expr.Expression |
parseResource(ClassLoader classLoader,
String path,
Charset encoding)
Parses the Java code contained in a resource and returns a
Expression that represents it. |
static com.github.javaparser.ast.expr.Expression |
parseResource(String path)
Parses the Java code contained in a resource and returns a
Expression that represents it. |
static com.github.javaparser.ast.expr.Expression |
parseResource(String path,
Charset encoding)
Parses the Java code contained in a resource and returns a
Expression that represents it. |
static com.github.javaparser.ast.expr.SimpleName |
parseSimpleName(String name)
Parses a simple name (one that can NOT have "."
|
static com.github.javaparser.ast.type.Type |
parseType(String type)
Parses a Java type name and returns a
Type that represents it. |
static void |
setStaticConfiguration(com.github.javaparser.ParserConfiguration staticConfiguration)
Set the configuration for the static parse... methods.
|
public MvelParser()
public MvelParser(com.github.javaparser.ParserConfiguration configuration)
public static com.github.javaparser.ParserConfiguration getStaticConfiguration()
public static void setStaticConfiguration(com.github.javaparser.ParserConfiguration staticConfiguration)
public com.github.javaparser.ParserConfiguration getParserConfiguration()
public <N extends com.github.javaparser.ast.Node> com.github.javaparser.ParseResult<N> parse(ParseStart<N> start, Provider provider)
N
- the subclass of Node that is the result of parsing in the start.start
- refer to the constants in ParseStart to see what can be parsed.provider
- refer to Providers to see how you can read source. The provider will be closed after parsing.public static com.github.javaparser.ast.expr.Expression parse(InputStream in, Charset encoding)
InputStream
and returns a
Expression
that represents it.in
- InputStream
containing Java source code. It will be closed after parsing.encoding
- encoding of the source codecom.github.javaparser.ParseProblemException
- if the source code has parser errorspublic static com.github.javaparser.ast.expr.Expression parse(InputStream in)
InputStream
and returns a
Expression
that represents it.in
- InputStream
containing Java source code. It will be closed after parsing.com.github.javaparser.ParseProblemException
- if the source code has parser errorspublic static com.github.javaparser.ast.expr.Expression parseResource(String path) throws IOException
Expression
that represents it.path
- path to a resource containing Java source code. As resource is accessed through a class loader, a
leading "/" is not allowed in pathToResourcecom.github.javaparser.ParseProblemException
- if the source code has parser errorsIOException
- the path could not be accessedpublic static com.github.javaparser.ast.expr.Expression parseResource(String path, Charset encoding) throws IOException
Expression
that represents it.path
- path to a resource containing Java source code. As resource is accessed through a class loader, a
leading "/" is not allowed in pathToResourceencoding
- encoding of the source codecom.github.javaparser.ParseProblemException
- if the source code has parser errorsIOException
- the path could not be accessedpublic static com.github.javaparser.ast.expr.Expression parseResource(ClassLoader classLoader, String path, Charset encoding) throws IOException
Expression
that represents it.classLoader
- the classLoader that is asked to load the resourcepath
- path to a resource containing Java source code. As resource is accessed through a class loader, a
leading "/" is not allowed in pathToResourcecom.github.javaparser.ParseProblemException
- if the source code has parser errorsIOException
- the path could not be accessedpublic static com.github.javaparser.ast.expr.Expression parse(Reader reader)
Expression
that represents it.reader
- the reader containing Java source code. It will be closed after parsing.com.github.javaparser.ParseProblemException
- if the source code has parser errorspublic static com.github.javaparser.ast.expr.Expression parse(String code)
Expression
that represents it.code
- Java source codecom.github.javaparser.ParseProblemException
- if the source code has parser errorspublic static com.github.javaparser.ast.stmt.BlockStmt parseBlock(String blockStatement)
String
and returns a
BlockStmt
that represents it.blockStatement
- String
containing Java block codecom.github.javaparser.ParseProblemException
- if the source code has parser errorspublic static <T extends com.github.javaparser.ast.expr.Expression> T parseExpression(String expression)
String
and returns a
Expression
that represents it.expression
- String
containing Java expressioncom.github.javaparser.ParseProblemException
- if the source code has parser errorspublic static com.github.javaparser.ast.type.ClassOrInterfaceType parseClassOrInterfaceType(String type)
ClassOrInterfaceType
that represents it.type
- the type name like a.b.c.X or Ycom.github.javaparser.ParseProblemException
- if the source code has parser errorspublic static com.github.javaparser.ast.type.Type parseType(String type)
Type
that represents it.type
- the type name like a.b.c.X, Y, or intcom.github.javaparser.ParseProblemException
- if the source code has parser errorspublic static com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt parseExplicitConstructorInvocationStmt(String statement)
statement
- a statement like super("hello");com.github.javaparser.ParseProblemException
- if the source code has parser errorspublic static com.github.javaparser.ast.expr.Name parseName(String qualifiedName)
qualifiedName
- a name like "com.laamella.parameter_source"com.github.javaparser.ParseProblemException
- if the source code has parser errorspublic static com.github.javaparser.ast.expr.SimpleName parseSimpleName(String name)
name
- a name like "parameter_source"com.github.javaparser.ParseProblemException
- if the source code has parser errorsCopyright © 2001–2019 JBoss by Red Hat. All rights reserved.