|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.plotnix.jex.Compiler
A compiler translates an expression string into an executable form. It validates the syntax of the expression and throws an exception if the syntax is invalid.
In order to introduce a new compiler, create a class called
"com.plotnix.jex.language-prefix.Compiler"
that
inherits from this class. Put it on the classpath. That's it.
Jex will find thenew class by the prefix and invoke it to compile
expressions in that language.
Constructor Summary | |
Compiler()
|
Method Summary | |
abstract Expression |
compileExpression(java.lang.String expression)
Compiles an expression intended for evaluation that produces a value. |
abstract IterationExpression |
compileIterationExpression(java.lang.String expression)
Compiles an expression describing an iteration. |
abstract VariableExpression |
compileVariableExpression(java.lang.String expression)
Compiles an expression describing the left hand side of an assignment. |
static Compiler |
getCompiler(java.lang.String language)
Locates and returns a Compiler for the specified language. |
protected static Compiler |
getCompilerImplementation(java.lang.String language)
Locates and returns a Compiler for the specified language. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Compiler()
Method Detail |
public static final Compiler getCompiler(java.lang.String language)
language
- is the name of an expression language (no colon
at the end)protected static final Compiler getCompilerImplementation(java.lang.String language)
language
- is the name of an expression language (no colon
at the end)public abstract Expression compileExpression(java.lang.String expression)
"2+2"
will be a valid argument for this method
for many expression languages.
May throw an UnsupportedOperationException.
expression
- is an expression in the corresponding languageContext
.public abstract IterationExpression compileIterationExpression(java.lang.String expression)
"addressBook//phone"
is a valid
argument for this method for an XPath compiler.
May throw an UnsupportedOperationException.
expression
- is an iteration expression in the corresponding languageContext
.public abstract VariableExpression compileVariableExpression(java.lang.String expression)
"addressBook/contact[name="John Doe"]/phone"
is a valid argument for this method for an XPath compiler.
May throw an UnsupportedOperationException.
expression
- is a variable expression in the corresponding languageContext
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |