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

net.sf.aguacate.function.spi.impl.FunctionGreaterThanToday 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.Date;

import net.sf.aguacate.function.FunctionEvalResult;
import net.sf.aguacate.function.Parameter;
import net.sf.aguacate.function.spi.AbstractFunction1;
import net.sf.aguacate.util.time.TimeUtil;

public class FunctionGreaterThanToday extends AbstractFunction1 {

	public FunctionGreaterThanToday(Collection methods, String name, String message, Parameter parameter) {
		super(methods, name, message, parameter, null);
	}

	@Override
	protected FunctionEvalResult evaluate(Object value) {
		String msg = MessageFormat.format(getMessage(), value);
		if (TimeUtil.today().compareTo((Date) value) >= 0) {
			logFailure(msg);
			return new FunctionEvalResult("Less or equals than today", null);
		} else {
			logSuccess(msg);
			return new FunctionEvalResult(null, null);
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy