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