|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.ttools.jel.JELUtils
public class JELUtils
This class provides some utility methods for use with the JEL expression compiler.
Field Summary | |
---|---|
static String |
CLASSES_PROPERTY
System property name for adding colon-separated list of additional classnames containing static methods. |
Constructor Summary | |
---|---|
JELUtils()
|
Method Summary | |
---|---|
static void |
checkExpressionType(gnu.jel.Library lib,
StarTable table,
String expr,
Class clazz)
Checks that an expression is legal and returns a particular class. |
static gnu.jel.CompiledExpression |
compile(gnu.jel.Library lib,
StarTable table,
String expr)
Compiles an expression in the context of a given table. |
static gnu.jel.CompiledExpression |
compile(gnu.jel.Library lib,
StarTable table,
String expr,
Class clazz)
Compiles an expression in the context of a given table with a required type for the result. |
static JELRowReader |
createDatalessRowReader(StarTable table)
Returns a row reader that can be used for expression evaluation, optionally in the context of the non-data parts of a given context table. |
static Class |
getExpressionType(gnu.jel.Library lib,
StarTable table,
String expr)
Gives the return type of an expression. |
static gnu.jel.Library |
getLibrary(JELRowReader reader)
Returns a JEL Library suitable for expression evaluation. |
static List<Class> |
getStaticClasses()
Returns the list of classes whose static methods will be mapped into the JEL evaluation namespace. |
static Class |
getWrapperType(Class clazz)
Returns a non-primitive version of a given class. |
static IOException |
toIOException(gnu.jel.CompilationException e,
String expr)
Utility method to convert a CompilationException into an IOException. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String CLASSES_PROPERTY
Constructor Detail |
---|
public JELUtils()
Method Detail |
---|
public static gnu.jel.Library getLibrary(JELRowReader reader)
reader
- object which can read rows from the table to
be used for expression evaluation; may be null if
there are no references to table-related expressions
public static JELRowReader createDatalessRowReader(StarTable table)
table
- context table, or null
public static List<Class> getStaticClasses()
public static Class getExpressionType(gnu.jel.Library lib, StarTable table, String expr) throws gnu.jel.CompilationException
lib
- JEL librarytable
- context tableexpr
- string representation of the expression
gnu.jel.CompilationException
- if expr cannot be compiledpublic static void checkExpressionType(gnu.jel.Library lib, StarTable table, String expr, Class clazz) throws gnu.jel.CompilationException
lib
- JEL librarytable
- context tableexpr
- string representation of the expressionclazz
- return type required from expr
gnu.jel.CompilationException
- if expr cannot be compiled
or will return a type other than clazz
(or one of its subtypes)public static gnu.jel.CompiledExpression compile(gnu.jel.Library lib, StarTable table, String expr, Class clazz) throws gnu.jel.CompilationException
lib
- JEL librarytable
- context tableexpr
- expression stringclazz
- required class of resulting expression
gnu.jel.CompilationException
public static gnu.jel.CompiledExpression compile(gnu.jel.Library lib, StarTable table, String expr) throws gnu.jel.CompilationException
lib
- JEL librarytable
- context tableexpr
- expression string
gnu.jel.CompilationException
public static IOException toIOException(gnu.jel.CompilationException e, String expr)
e
- compilation exceptionexpr
- expression for which compilation failed,
to be reported in error messagepublic static Class getWrapperType(Class clazz)
clazz
- input class
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |