net.sf.aguacate.function.spi.impl.FunctionBase64Decode Maven / Gradle / Ivy
package net.sf.aguacate.function.spi.impl;
import java.util.Base64;
import java.util.Collection;
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;
public class FunctionBase64Decode extends AbstractFunction1 {
private final String[] outputContext;
private final String outputName;
public FunctionBase64Decode(Collection methods, String name, String message, Parameter parameter,
Collection outputContext, String outputName) {
super(methods, name, message, parameter);
this.outputContext = Str.toArray(outputContext);
this.outputName = outputName;
}
@Override
protected FunctionEvalResult evaluate(FunctionContext functionContext, String msg, Object value) {
return new FunctionEvalResult(true, Base64.getDecoder().decode((String) value));
}
@Override
public String[] getOutputContext() {
return outputContext;
}
@Override
public String getOutputName() {
return outputName;
}
}