net.sf.aguacate.function.spi.impl.FunctionGreaterThanToday Maven / Gradle / Ivy
package net.sf.aguacate.function.spi.impl;
import java.util.Collection;
import java.util.Date;
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;
public class FunctionGreaterThanToday extends AbstractFunction1 {
public FunctionGreaterThanToday(Collection methods, String name, String message, Parameter parameter) {
super(methods, name, message, parameter);
}
@Override
protected FunctionEvalResult evaluate(FunctionContext functionContext, String msg, Object value) {
if (new Date().compareTo((Date) value) >= 0) {
logFailure(msg);
return new FunctionEvalResult("Less or equals than today", null);
} else {
logSuccess(msg);
return new FunctionEvalResult(null, null);
}
}
}