All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.aguacate.function.spi.impl.FunctionLiteralString Maven / Gradle / Ivy

There is a newer version: 0.10.9
Show newest version
package net.sf.aguacate.function.spi.impl;

import java.text.MessageFormat;
import java.util.Collection;
import java.util.List;
import java.util.Map;

import net.sf.aguacate.function.FunctionContext;
import net.sf.aguacate.function.FunctionEvalResult;
import net.sf.aguacate.function.spi.AbstractFunction;
import net.sf.aguacate.util.type.Str;

public class FunctionLiteralString extends AbstractFunction {

	private final String outputName;

	private final String[] outputContext;

	private final FunctionEvalResult result;

	private final String message;

	public FunctionLiteralString(Collection methods, String name, String message, List outputContext,
			String outputName, Object value) {
		super(methods, name);
		this.outputContext = Str.toArray(outputContext);
		this.outputName = outputName;
		this.result = new FunctionEvalResult(true, (String) value);
		this.message = message;
	}

	@Override
	public FunctionEvalResult evaluate(FunctionContext functionContext, Map context) {
		logSuccess(MessageFormat.format(message, result.getData()));
		return result;
	}

	@Override
	public String[] getOutputContext() {
		return outputContext;
	}

	@Override
	public String getOutputName() {
		return outputName;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy