public class AggregatorContext extends Object implements org.apache.commons.jexl3.JexlContext.NamespaceResolver, org.apache.commons.jexl3.JexlContext
| Modifier and Type | Class and Description |
|---|---|
static interface |
AggregatorContext.AggregatorJEXLBuilder |
org.apache.commons.jexl3.JexlContext.AnnotationProcessor, org.apache.commons.jexl3.JexlContext.NamespaceFunctor, org.apache.commons.jexl3.JexlContext.NamespaceResolver, org.apache.commons.jexl3.JexlContext.ThreadLocal| Constructor and Description |
|---|
AggregatorContext()
Constructor :-)
|
AggregatorContext(boolean debug) |
| Modifier and Type | Method and Description |
|---|---|
void |
addVariable(String variable,
Object object) |
protected Object |
aggregate(String aggregator,
String name,
boolean canSplit,
AggregatorContext.AggregatorJEXLBuilder expressionBuilder,
Object orElse) |
Set<String> |
aggregators()
all aggregators in this context
|
Object[] |
asArray(String aggregator)
return aggregated values As Array
|
Set<Object> |
asSet(String aggregator)
return aggregated values as Set
|
Object |
avg(String aggregator)
does sum/count for an aggregator, result is floating point (usually double)
|
void |
cleanContext(String prefix)
removes all elements from context starting
|
protected void |
collect(String aggregator,
String objectReference)
Used by processor to collect object references
|
Boolean |
contains(String aggregator,
Object object)
if Object was aggregated return true.
|
Integer |
count(String aggregator)
Count how many objects have been collected in an aggregator
|
void |
endContext(String value)
stops trace of context
|
void |
endProcess() |
Object |
evaluate(String expression)
Evaluate the expression against the context, additionally to the JEXL syntax
you can use - sum - avg - count - join see methods with same name in this
class for more information
|
Object |
execute(String field,
String formula) |
Object |
get(String s) |
String |
getLastProcessTrace() |
String |
getPackageStart() |
boolean |
has(String s) |
boolean |
isDebug() |
Object |
join(String separator,
String aggregator)
Joins all objects that have been collected in an aggregator into a string
separated by separator
|
void |
register(String namespace,
Object o)
Register an object (or a class) to a namespace.
|
Object |
resolveNamespace(String s) |
void |
set(String s,
Object o) |
void |
setPackageStart(String packageStart) |
int |
size() |
void |
startContext(String contextName)
Trace context start
|
void |
startProcess() |
Object |
sum(String aggregator)
Sum all objects collected in an aggregator (may be problematic if JEXL cannot
sum those objects with "+" operand)
|
Object |
sum(String aggregator,
Object orElse)
Sum all objects collected in an aggregator (may be problematic if JEXL cannot
sum those objects with "+" operand)
|
public AggregatorContext()
public AggregatorContext(boolean debug)
public void register(String namespace, Object o)
namespace - the string to prefix the functionso - the object or class containing functions to registerpublic Object evaluate(String expression)
expression - expression to evaluatepublic Object join(String separator, String aggregator)
separator - the String to use as separatoraggregator - the aggregator to joinpublic Integer count(String aggregator)
aggregator - the aggregator to count elements forpublic Boolean contains(String aggregator, Object object)
aggregator - the aggregator to evaluateobject - the object to search reference forpublic Object sum(String aggregator, Object orElse)
aggregator - the aggregator to evaluateorElse - the default value to return in case not found or no elements in aggregatorpublic Object sum(String aggregator)
aggregator - the aggregatorpublic Object avg(String aggregator)
aggregator - the aggregatorpublic Object[] asArray(String aggregator)
aggregator - the aggregatorpublic Set<Object> asSet(String aggregator)
aggregator - the aggregatorpublic Set<String> aggregators()
protected Object aggregate(String aggregator, String name, boolean canSplit, AggregatorContext.AggregatorJEXLBuilder expressionBuilder, Object orElse)
protected void collect(String aggregator, String objectReference)
aggregator - aggregator's name to collectobjectReference - the reference to the element to collectpublic Object resolveNamespace(String s)
resolveNamespace in interface org.apache.commons.jexl3.JexlContext.NamespaceResolverpublic void set(String s, Object o)
set in interface org.apache.commons.jexl3.JexlContextpublic boolean has(String s)
has in interface org.apache.commons.jexl3.JexlContextpublic void cleanContext(String prefix)
prefix - the prefix of all aggregators to cleanpublic void startContext(String contextName)
contextName - the context name to tracepublic void endContext(String value)
value - the context name to stoppublic String getLastProcessTrace()
public void startProcess()
public void endProcess()
public boolean isDebug()
public String getPackageStart()
public void setPackageStart(String packageStart)
public int size()
Copyright © 2018. All rights reserved.