Package com.schibsted.spt.data.jslt
Class Parser
java.lang.Object
com.schibsted.spt.data.jslt.Parser
Parses JSLT expressions to Expression objects for evaluating them.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Collection
<Function> private JsonFilter
private Reader
private ResourceResolver
private String
-
Constructor Summary
ConstructorsModifierConstructorDescriptionCreate a Parser reading JSLT source from the given Reader.private
Parser
(String source, Reader reader, Collection<Function> functions, ResourceResolver resolver, Map<String, Module> modules, JsonFilter filter) -
Method Summary
Modifier and TypeMethodDescriptioncompile()
Compile the JSLT from the defined parameters.static Expression
Compile the given JSLT file.static Expression
compile
(File jslt, Collection<Function> functions) Compile the given JSLT file with the given predefined functions.static Expression
compile
(String source, Reader reader, Collection<Function> functions) Compile JSLT expression from the Reader.static Expression
compileResource
(String jslt) Load and compile JSLT expression from the classpath.static Expression
compileResource
(String jslt, Collection<Function> functions) Load and compile JSLT expression from the classpath with the given extension functions.static Expression
compileString
(String jslt) Compile JSLT expression given as an inline string.static Expression
compileString
(String jslt, Collection<Function> functions) Compile JSLT expression given as an inline string with the given extension functions.withFunctions
(Collection<Function> theseFunctions) Create a new Parser with the given extension functions.withNamedModules
(Map<String, Module> thisModules) Create a new Parser with the given modules registered.withObjectFilter
(JsonFilter filter) Create a new Parser with the given filter for object values.withObjectFilter
(String filter) Create a new Parser with the given filter for object values.withResourceResolver
(ResourceResolver thisResolver) Create a new Parser with the given resource resolver.withSource
(String thisSource) Create a new Parser with the given source name.
-
Field Details
-
functions
-
source
-
reader
-
resolver
-
modules
-
objectFilter
-
-
Constructor Details
-
Parser
private Parser(String source, Reader reader, Collection<Function> functions, ResourceResolver resolver, Map<String, Module> modules, JsonFilter filter) -
Parser
Create a Parser reading JSLT source from the given Reader. Uses aClasspathResourceResolver
for import statements.
-
-
Method Details
-
compile
Compile the given JSLT file. -
compile
Compile the given JSLT file with the given predefined functions. -
compileString
Compile JSLT expression given as an inline string. -
compileString
Compile JSLT expression given as an inline string with the given extension functions. -
compileResource
Load and compile JSLT expression from the classpath. -
compileResource
Load and compile JSLT expression from the classpath with the given extension functions. -
compile
Compile JSLT expression from the Reader. The source is just a name used in error messages, and has no practical effect. -
withSource
Create a new Parser with the given source name. The name is a string used in error messages. -
withFunctions
Create a new Parser with the given extension functions. -
withResourceResolver
Create a new Parser with the given resource resolver. -
withNamedModules
Create a new Parser with the given modules registered. The keys in the map are the module "names", and importing these names will bind a prefix to the modules in this map. The names can follow any syntax. -
withObjectFilter
Create a new Parser with the given filter for object values. For all key/value pairs in objects being created, if this filter returns false when given the value, the key/value pair is omitted. -
withObjectFilter
Create a new Parser with the given filter for object values. For all key/value pairs in objects being created, if this filter returns false when given the value, the key/value pair is omitted. -
compile
Compile the JSLT from the defined parameters.
-