Class CollectListAccumulateFunction
- java.lang.Object
-
- org.drools.core.base.accumulators.AbstractAccumulateFunction<CollectListAccumulateFunction.CollectListData>
-
- org.drools.core.base.accumulators.CollectListAccumulateFunction
-
- All Implemented Interfaces:
java.io.Externalizable,java.io.Serializable,org.kie.api.runtime.rule.AccumulateFunction<CollectListAccumulateFunction.CollectListData>
public class CollectListAccumulateFunction extends AbstractAccumulateFunction<CollectListAccumulateFunction.CollectListData>
An implementation of an accumulator capable of collecting lists of values. This is similar to the "collect" CE, but allows us to collect any value, not only facts.
Example:
rule "List employee names" when $names : List() from accumulate( Employee( $n : firstName, $l : lastName ), collectList( $n + " " + $l ) ) then // do something endThe list accepts duplications and the order of the elements in the list is not guaranteed.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCollectListAccumulateFunction.CollectListData
-
Constructor Summary
Constructors Constructor Description CollectListAccumulateFunction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccumulate(CollectListAccumulateFunction.CollectListData data, java.lang.Object value)CollectListAccumulateFunction.CollectListDatacreateContext()java.lang.ObjectgetResult(CollectListAccumulateFunction.CollectListData data)java.lang.Class<?>getResultType()voidinit(CollectListAccumulateFunction.CollectListData data)voidreadExternal(java.io.ObjectInput in)voidreverse(CollectListAccumulateFunction.CollectListData data, java.lang.Object value)booleansupportsReverse()voidwriteExternal(java.io.ObjectOutput out)-
Methods inherited from class org.drools.core.base.accumulators.AbstractAccumulateFunction
equals, hashCode
-
-
-
-
Method Detail
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException- Throws:
java.io.IOException
-
createContext
public CollectListAccumulateFunction.CollectListData createContext()
-
init
public void init(CollectListAccumulateFunction.CollectListData data)
-
accumulate
public void accumulate(CollectListAccumulateFunction.CollectListData data, java.lang.Object value)
-
reverse
public void reverse(CollectListAccumulateFunction.CollectListData data, java.lang.Object value)
-
getResult
public java.lang.Object getResult(CollectListAccumulateFunction.CollectListData data)
-
supportsReverse
public boolean supportsReverse()
-
getResultType
public java.lang.Class<?> getResultType()
-
-