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

net.sf.aguacate.configuration.field.FieldNumber Maven / Gradle / Ivy

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

import net.sf.aguacate.validator.ValidationConversionResult;

public abstract class FieldNumber extends Field {

	public FieldNumber(String name, String type, boolean optional) {
		super(name, type, optional);
	}

	> ValidationConversionResult validate(T min, T val, T max) {
		if (val.compareTo(min) < 0) {
			return new ValidationConversionResult("Invalid minimum value");
		} else {
			if (val.compareTo(max) > 0) {
				return new ValidationConversionResult("Invalid maximum value");
			} else {
				return new ValidationConversionResult(val);
			}
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy