Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

DateTimeRangeValidator.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.time.LocalDateTime;
  18. import java.util.Comparator;
  19. /**
  20. * Validator for validating that a {@link LocalDateTime} is inside a given
  21. * range.
  22. *
  23. * @author Vaadin Ltd.
  24. * @since 8.0
  25. */
  26. public class DateTimeRangeValidator extends RangeValidator<LocalDateTime> {
  27. /**
  28. * Creates a validator for checking that a {@link LocalDateTime} is within a
  29. * given range.
  30. * <p>
  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. * </p>
  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 DateTimeRangeValidator(String errorMessage, LocalDateTime minValue,
  44. LocalDateTime maxValue) {
  45. super(errorMessage, Comparator.naturalOrder(), minValue, maxValue);
  46. }
  47. }