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

net.sf.aguacate.model.FieldDynamicDate Maven / Gradle / Ivy

There is a newer version: 0.10.9
Show newest version
package net.sf.aguacate.model;

import java.util.Date;

import net.sf.aguacate.util.time.TimeUtil;

public class FieldDynamicDate extends FieldDateTime {

	private final String minValue;

	private final String maxValue;

	public FieldDynamicDate(String name, FieldType type, boolean optional, String minValue, String maxValue) {
		super(name, type, optional);
		this.minValue = minValue;
		this.maxValue = maxValue;
	}

	@Override
	public Date getMinValue() {
		if ("TODAY".equalsIgnoreCase(minValue)) {
			return TimeUtil.today();
		} else {
			throw new IllegalStateException(minValue);
		}
	}
	
	@Override
	public Date getMaxValue() {
		if("FUTURE".equalsIgnoreCase(maxValue)) {
			return TimeUtil.limit();
		} else {
			throw new IllegalStateException(maxValue);
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy