net.sf.aguacate.function.spi.impl.FunctionArrayIterator Maven / Gradle / Ivy
package net.sf.aguacate.function.spi.impl;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.sf.aguacate.function.Function;
import net.sf.aguacate.function.FunctionContext;
import net.sf.aguacate.function.FunctionEvalResult;
import net.sf.aguacate.function.spi.AbstractFunction1;
import net.sf.aguacate.util.parameter.Parameter;
import net.sf.aguacate.util.type.Str;
/**
*
* {
* "name": "...",
* "message": "...",
* "type" : "STRUCTURE_ARRAY_ITERATOR",
* "parameters" : [
* ...
* ],
* "validations": [
* ...
* ],
* "methods": [
* ...
* ]
* }
*
*/
public class FunctionArrayIterator extends AbstractFunction1 {
private static final Logger LOGGER = LogManager.getLogger(FunctionArrayIterator.class);
private final String[] outputContext;
private final String outputName;
private final Function[] functions;
public FunctionArrayIterator(Collection methods, String name, String message, Parameter parameter,
List outputContext, String outputName, List list) {
super(methods, name, message, parameter);
this.outputContext = Str.toArray(outputContext);
this.outputName = outputName;
this.functions = list.toArray(new Function[list.size()]);
}
@Override
public FunctionEvalResult evaluate(FunctionContext functionContext, String msg, Object value) {
@SuppressWarnings("unchecked")
List