Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

BigDecimalRangeValidator.java 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright 2000-2018 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.data.validator;
  17. import java.math.BigDecimal;
  18. import java.util.Comparator;
  19. /**
  20. * Validator for validating that an {@link BigDecimal} is inside a given range.
  21. *
  22. * @author Vaadin Ltd.
  23. * @since 8.0
  24. */
  25. @SuppressWarnings("serial")
  26. public class BigDecimalRangeValidator extends RangeValidator<BigDecimal> {
  27. /**
  28. * Creates a validator for checking that an BigDecimal is within a given
  29. * range.
  30. *
  31. * By default the range is inclusive i.e. both minValue and maxValue are
  32. * valid values. Use {@link #setMinValueIncluded(boolean)} or
  33. * {@link #setMaxValueIncluded(boolean)} to change it.
  34. *
  35. *
  36. * @param errorMessage
  37. * the message to display in case the value does not validate.
  38. * @param minValue
  39. * The minimum value to accept or null for no limit
  40. * @param maxValue
  41. * The maximum value to accept or null for no limit
  42. */
  43. public BigDecimalRangeValidator(String errorMessage, BigDecimal minValue,
  44. BigDecimal maxValue) {
  45. super(errorMessage, Comparator.naturalOrder(), minValue, maxValue);
  46. }
  47. }