org.drools.core.base.accumulators
Class CollectSetAccumulateFunction
java.lang.Object
org.drools.core.base.accumulators.CollectSetAccumulateFunction
- All Implemented Interfaces:
- Externalizable, Serializable, org.kie.api.runtime.rule.AccumulateFunction
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.
- See Also:
- Serialized Form
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CollectSetAccumulateFunction
public CollectSetAccumulateFunction()
readExternal
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
- Specified by:
readExternal in interface Externalizable
- Throws:
IOException
ClassNotFoundException
writeExternal
public void writeExternal(ObjectOutput out)
throws IOException
- Specified by:
writeExternal in interface Externalizable
- Throws:
IOException
createContext
public Serializable createContext()
- Specified by:
createContext in interface org.kie.api.runtime.rule.AccumulateFunction
init
public void init(Serializable context)
throws Exception
- Specified by:
init in interface org.kie.api.runtime.rule.AccumulateFunction
- Throws:
Exception
accumulate
public void accumulate(Serializable context,
Object value)
- Specified by:
accumulate in interface org.kie.api.runtime.rule.AccumulateFunction
reverse
public void reverse(Serializable context,
Object value)
throws Exception
- Specified by:
reverse in interface org.kie.api.runtime.rule.AccumulateFunction
- Throws:
Exception
getResult
public Object getResult(Serializable context)
throws Exception
- Specified by:
getResult in interface org.kie.api.runtime.rule.AccumulateFunction
- Throws:
Exception
supportsReverse
public boolean supportsReverse()
- Specified by:
supportsReverse in interface org.kie.api.runtime.rule.AccumulateFunction
getResultType
public Class<?> getResultType()
-
- Specified by:
getResultType in interface org.kie.api.runtime.rule.AccumulateFunction
Copyright © 2001-2013 JBoss by Red Hat. All Rights Reserved.