diff options
Diffstat (limited to 'Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/validators/FloatRangeValidator.java')
-rw-r--r-- | Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/validators/FloatRangeValidator.java | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/validators/FloatRangeValidator.java b/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/validators/FloatRangeValidator.java deleted file mode 100644 index 8cca9230..00000000 --- a/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/validators/FloatRangeValidator.java +++ /dev/null @@ -1,57 +0,0 @@ -package at.asit.pdfover.pdfsignator.profileproperties.validators; - -import at.asit.pdfover.pdfsignator.InvalidPropertyTypeException; -import at.asit.pdfover.pdfsignator.InvalidPropertyValueException; -import at.asit.pdfover.pdfsignator.profileproperties.FloatProfileProperty; -import at.asit.pdfover.pdfsignator.profileproperties.ProfileProperty; - -public class FloatRangeValidator extends PropertyValidator { - - /** - * The maximum value - */ - protected float max; - - /** - * The minimum value - */ - protected float min; - - /** - * Constructor - * @param min The minimum allowed value - * @param max The maximum allowed value - */ - public FloatRangeValidator(float min, float max) { - this.max = max; - this.min = min; - } - - @Override - public void validate(ProfileProperty property) - throws InvalidPropertyValueException, InvalidPropertyTypeException { - this.CheckPropertyType(property); - - FloatProfileProperty prop = (FloatProfileProperty) property; - - if (prop.GetValue() == null) { - throw new InvalidPropertyValueException(property, - "Value is not set!"); - } - - float value = prop.GetValue(); - - if (value < min || value > max) { - throw new InvalidPropertyValueException(property, String.format( - "Value has to be between %f and %f", min, max)); - } - } - - @Override - public void CheckPropertyType(ProfileProperty property) - throws InvalidPropertyTypeException { - if (!(property instanceof FloatProfileProperty)) { - throw new InvalidPropertyTypeException(property, this); - } - } -} |