public class CollectSetAccumulateFunction extends Object implements org.kie.api.runtime.rule.AccumulateFunction
An implementation of an accumulator capable of collecting sets of values. This is similar to the "collect" CE, but allows us to collect any value, not only facts.
Example:
rule "Set of unique employee names"
when
$names : Set() from accumulate(
Employee( $n : firstName, $l : lastName ),
collectSet( $n + " " + $l ) )
then
// do something
end
The set obviously does not computes duplications and the order of the elements in the set is not guaranteed.
| Modifier and Type | Class and Description |
|---|---|
static class |
CollectSetAccumulateFunction.CollectListData |
| Constructor and Description |
|---|
CollectSetAccumulateFunction() |
| Modifier and Type | Method and Description |
|---|---|
void |
accumulate(Serializable context,
Object value) |
Serializable |
createContext() |
Object |
getResult(Serializable context) |
Class<?> |
getResultType() |
void |
init(Serializable context) |
void |
readExternal(ObjectInput in) |
void |
reverse(Serializable context,
Object value) |
boolean |
supportsReverse() |
void |
writeExternal(ObjectOutput out) |
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionpublic void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic Serializable createContext()
createContext in interface org.kie.api.runtime.rule.AccumulateFunctionpublic void init(Serializable context) throws Exception
init in interface org.kie.api.runtime.rule.AccumulateFunctionExceptionpublic void accumulate(Serializable context, Object value)
accumulate in interface org.kie.api.runtime.rule.AccumulateFunctionpublic void reverse(Serializable context, Object value) throws Exception
reverse in interface org.kie.api.runtime.rule.AccumulateFunctionExceptionpublic Object getResult(Serializable context) throws Exception
getResult in interface org.kie.api.runtime.rule.AccumulateFunctionExceptionpublic boolean supportsReverse()
supportsReverse in interface org.kie.api.runtime.rule.AccumulateFunctionpublic Class<?> getResultType()
getResultType in interface org.kie.api.runtime.rule.AccumulateFunctionCopyright © 2001–2016 JBoss by Red Hat. All rights reserved.