| Constructor and Description |
|---|
DefaultContext() |
| Modifier and Type | Method and Description |
|---|---|
Context |
addFunction(String name,
BiFunction<Object[],org.apache.sling.api.resource.Resource,Object> functionImpl)
Adds a Function to the script to allow for customization.
|
Context |
addParameter(String name,
Object object)
Allows an object to be represented in the script for evaluation.
|
void |
addParameters(Map<String,Object> params)
Adds the provided Map to the underlying parameter map.
|
Visitor<Function<org.apache.sling.api.resource.Resource,Object>> |
getComparisonVisitor()
Retrieve the currently defined Comparison Visitor
|
Optional<BiFunction<Object[],org.apache.sling.api.resource.Resource,Object>> |
getFunction(String text)
Used to retrieve the function during script processing
|
Visitor<Predicate<org.apache.sling.api.resource.Resource>> |
getLogicVisitor()
Retrieve the currently defined Logic Visitor
|
Optional<Object> |
getParameter(String text)
Retrieves the value object associated with the name
|
Context |
removeFunction(String name)
Remove the function with the given name from the context.
|
Context |
replaceParameterMap(Map<String,Object> params)
Replaces the underlying parameter Map with the one provided
|
void |
setComparionVisitor(Visitor<Function<org.apache.sling.api.resource.Resource,Object>> comparisonVisitor)
Replaces the existing Comparison Visitor, if present, with the provided Visitor
|
void |
setLogicVisitor(Visitor<Predicate<org.apache.sling.api.resource.Resource>> logicVisitor)
Replaces the existing Logic Visitor, if present, with the provided Visitor
|
public Context addFunction(String name, BiFunction<Object[],org.apache.sling.api.resource.Resource,Object> functionImpl)
ContextaddFunction in interface Contextname - of the function as it appears in the scriptfunctionImpl - defines the function in terms of passed in arguments, the resource
that is being acted on and the return objectpublic Context removeFunction(String name)
ContextremoveFunction in interface Contextpublic Context addParameter(String name, Object object)
ContextaddParameter in interface Contextname - of the argumentobject - value that is representedpublic Visitor<Predicate<org.apache.sling.api.resource.Resource>> getLogicVisitor()
ContextgetLogicVisitor in interface Contextpublic Visitor<Function<org.apache.sling.api.resource.Resource,Object>> getComparisonVisitor()
ContextgetComparisonVisitor in interface Contextpublic void setLogicVisitor(Visitor<Predicate<org.apache.sling.api.resource.Resource>> logicVisitor)
ContextsetLogicVisitor in interface Contextpublic void setComparionVisitor(Visitor<Function<org.apache.sling.api.resource.Resource,Object>> comparisonVisitor)
ContextsetComparionVisitor in interface Contextpublic Optional<BiFunction<Object[],org.apache.sling.api.resource.Resource,Object>> getFunction(String text)
ContextgetFunction in interface Contexttext - of the function in the contextpublic Optional<Object> getParameter(String text)
ContextgetParameter in interface Contexttext - of the argumentpublic void addParameters(Map<String,Object> params)
ContextaddParameters in interface ContextCopyright © 2007–2018 The Apache Software Foundation. All rights reserved.