public interface Context
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 name)
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 name)
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
|
Context addFunction(String name, BiFunction<Object[],org.apache.sling.api.resource.Resource,Object> functionImpl)
name
- 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 objectContext removeFunction(String name)
name
- Visitor<Predicate<org.apache.sling.api.resource.Resource>> getLogicVisitor()
Visitor<Function<org.apache.sling.api.resource.Resource,Object>> getComparisonVisitor()
void setLogicVisitor(Visitor<Predicate<org.apache.sling.api.resource.Resource>> logicVisitor)
Visitor
- void setComparionVisitor(Visitor<Function<org.apache.sling.api.resource.Resource,Object>> comparisonVisitor)
comparisonVisitor
- Optional<BiFunction<Object[],org.apache.sling.api.resource.Resource,Object>> getFunction(String name)
name
- of the function in the contextOptional<Object> getParameter(String name)
name
- of the argumentContext addParameter(String name, Object object)
name
- of the argumentobject
- value that is representedvoid addParameters(Map<String,Object> params)
params
- Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.