Class InvokableIteratorMethod
- java.lang.Object
-
- org.nuxeo.ecm.automation.core.impl.InvokableMethod
-
- org.nuxeo.ecm.automation.core.impl.InvokableIteratorMethod
-
- All Implemented Interfaces:
Comparable<InvokableMethod>
public class InvokableIteratorMethod extends InvokableMethod
A method proxy which accept as input only iterable inputs. At invocation time it iterates over the input elements and invoke the real method using the current input element as the input.The result is collected into a
OutputCollector
as specified by theOperationMethod
annotation.This proxy is used (instead of the default
InvokableMethod
) when an operation is defining an output collector in theOperationMethod
annotation so that iterable inputs are automatically handled by the chain executor.This specialized implementation is declaring the same consume type as its non-iterable counterpart. But at runtime it consumes any Iterable of the cosume type.
To correctly generate the operation documentation the
OperationTypeImpl
is checking if the method is iterable or not throughisIterable()
to declare the correct consume type.- Author:
- Bogdan Stefanescu
-
-
Field Summary
Fields Modifier and Type Field Description protected Class<? extends OutputCollector>
collector
-
Fields inherited from class org.nuxeo.ecm.automation.core.impl.InvokableMethod
ADAPTABLE_PRIORITY, asyncService, consume, EXACT_MATCH_PRIORITY, ISTANCE_OF_PRIORITY, log, method, op, priority, produce, USER_PRIORITY, VOID_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description InvokableIteratorMethod(OperationType op, Method method, OperationMethod anno)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Object
doInvoke(OperationContext ctx, Map<String,Object> args)
int
inputMatch(Class<?> in)
Return 0 for no match.boolean
isIterable()
-
Methods inherited from class org.nuxeo.ecm.automation.core.impl.InvokableMethod
compareTo, getAsyncService, getConsume, getExceptionMessage, getInputType, getMethod, getOperation, getOutputType, getPriority, getProduce, invoke, toString
-
-
-
-
Field Detail
-
collector
protected Class<? extends OutputCollector> collector
-
-
Constructor Detail
-
InvokableIteratorMethod
public InvokableIteratorMethod(OperationType op, Method method, OperationMethod anno)
-
-
Method Detail
-
isIterable
public boolean isIterable()
- Overrides:
isIterable
in classInvokableMethod
-
inputMatch
public int inputMatch(Class<?> in)
Description copied from class:InvokableMethod
Return 0 for no match.- Overrides:
inputMatch
in classInvokableMethod
-
doInvoke
protected Object doInvoke(OperationContext ctx, Map<String,Object> args) throws OperationException, ReflectiveOperationException
- Overrides:
doInvoke
in classInvokableMethod
- Throws:
OperationException
ReflectiveOperationException
-
-