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 JsonFilterprivate Readerprivate ResourceResolverprivate String -
Constructor Summary
ConstructorsModifierConstructorDescriptionCreate a Parser reading JSLT source from the given Reader.privateParser(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 ExpressionCompile the given JSLT file.static Expressioncompile(File jslt, Collection<Function> functions) Compile the given JSLT file with the given predefined functions.static Expressioncompile(String source, Reader reader, Collection<Function> functions) Compile JSLT expression from the Reader.static ExpressioncompileResource(String jslt) Load and compile JSLT expression from the classpath.static ExpressioncompileResource(String jslt, Collection<Function> functions) Load and compile JSLT expression from the classpath with the given extension functions.static ExpressioncompileString(String jslt) Compile JSLT expression given as an inline string.static ExpressioncompileString(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 aClasspathResourceResolverfor 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
-
withFunctions
Create a new Parser with the given extension functions. -
withResourceResolver
Create a new Parser with the given resource resolver. -
withNamedModules
-
withObjectFilter
-
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.
-