public class JELUtils
extends java.lang.Object
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
CLASSES_PROPERTY |
System property name for adding colon-separated list of
additional classnames containing static methods.
|
Constructor | Description |
---|---|
JELUtils() |
Modifier and Type | Method | Description |
---|---|---|
static void |
checkExpressionType(gnu.jel.Library lib,
uk.ac.starlink.table.StarTable table,
java.lang.String expr,
java.lang.Class clazz) |
Checks that an expression is legal and returns a particular class.
|
static gnu.jel.CompiledExpression |
compile(gnu.jel.Library lib,
uk.ac.starlink.table.StarTable table,
java.lang.String expr) |
Compiles an expression in the context of a given table.
|
static gnu.jel.CompiledExpression |
compile(gnu.jel.Library lib,
uk.ac.starlink.table.StarTable table,
java.lang.String expr,
java.lang.Class clazz) |
Compiles an expression in the context of a given table with a
required type for the result.
|
static JELQuantity |
compileQuantity(gnu.jel.Library lib,
StarTableJELRowReader jelRdr,
java.lang.String expr,
java.lang.Class clazz) |
Compiles an expression in the context of a table reader to give
a JELQuantity.
|
static JELRowReader |
createDatalessRowReader(uk.ac.starlink.table.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 java.lang.Class |
getExpressionType(gnu.jel.Library lib,
uk.ac.starlink.table.StarTable table,
java.lang.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 java.util.List<java.lang.Class> |
getStaticClasses() |
Returns the list of classes whose static methods will be mapped
into the JEL evaluation namespace.
|
static java.lang.Class |
getWrapperType(java.lang.Class clazz) |
Returns a non-primitive version of a given class.
|
static java.io.IOException |
toIOException(gnu.jel.CompilationException e,
java.lang.String expr) |
Utility method to convert a CompilationException into an IOException.
|
public static final java.lang.String CLASSES_PROPERTY
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 expressionspublic static JELRowReader createDatalessRowReader(uk.ac.starlink.table.StarTable table)
table
- context table, or nullpublic static java.util.List<java.lang.Class> getStaticClasses()
public static java.lang.Class getExpressionType(gnu.jel.Library lib, uk.ac.starlink.table.StarTable table, java.lang.String expr) throws gnu.jel.CompilationException
lib
- JEL librarytable
- context tableexpr
- string representation of the expressiongnu.jel.CompilationException
- if expr cannot be compiledpublic static void checkExpressionType(gnu.jel.Library lib, uk.ac.starlink.table.StarTable table, java.lang.String expr, java.lang.Class clazz) throws gnu.jel.CompilationException
lib
- JEL librarytable
- context tableexpr
- string representation of the expressionclazz
- return type required from exprgnu.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, uk.ac.starlink.table.StarTable table, java.lang.String expr, java.lang.Class clazz) throws gnu.jel.CompilationException
lib
- JEL librarytable
- context tableexpr
- expression stringclazz
- required class of resulting expressiongnu.jel.CompilationException
public static gnu.jel.CompiledExpression compile(gnu.jel.Library lib, uk.ac.starlink.table.StarTable table, java.lang.String expr) throws gnu.jel.CompilationException
lib
- JEL librarytable
- context tableexpr
- expression stringgnu.jel.CompilationException
public static JELQuantity compileQuantity(gnu.jel.Library lib, StarTableJELRowReader jelRdr, java.lang.String expr, java.lang.Class clazz) throws gnu.jel.CompilationException
compile
methods, but it provides additional metadata if it can be retrieved
from the table context.lib
- JEL libraryjelRdr
- context table readerexpr
- expression stringclazz
- required return type of compiled expression,
or null if no requirementgnu.jel.CompilationException
public static java.io.IOException toIOException(gnu.jel.CompilationException e, java.lang.String expr)
e
- compilation exceptionexpr
- expression for which compilation failed,
to be reported in error messagepublic static java.lang.Class getWrapperType(java.lang.Class clazz)
clazz
- input classCopyright © 2018 Central Laboratory of the Research Councils. All Rights Reserved.