Class CollectSetAccumulateFunction
java.lang.Object
org.drools.core.base.accumulators.AbstractAccumulateFunction<CollectSetAccumulateFunction.CollectListData>
org.drools.core.base.accumulators.CollectSetAccumulateFunction
- All Implemented Interfaces:
Externalizable,Serializable,AccumulateFunction<CollectSetAccumulateFunction.CollectListData>
public class CollectSetAccumulateFunction
extends AbstractAccumulateFunction<CollectSetAccumulateFunction.CollectListData>
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:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaccumulate(CollectSetAccumulateFunction.CollectListData data, Object value) Class<?>voidvoidvoidreverse(CollectSetAccumulateFunction.CollectListData data, Object value) booleanvoidMethods inherited from class org.drools.core.base.accumulators.AbstractAccumulateFunction
equals, hashCodeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.kie.api.runtime.rule.AccumulateFunction
accumulateValue, initContext, tryReverse
-
Constructor Details
-
CollectSetAccumulateFunction
public CollectSetAccumulateFunction()
-
-
Method Details
-
readExternal
- Throws:
IOExceptionClassNotFoundException
-
writeExternal
- Throws:
IOException
-
createContext
-
init
-
accumulate
-
reverse
-
getResult
-
supportsReverse
public boolean supportsReverse() -
getResultType
-