Class GroupValidators

java.lang.Object
ch.tocco.nice2.validate.api.validators.GroupValidators

public final class GroupValidators extends Object
Static utility methods for dealing with group validators.
  • Method Details

    • getServerView

      public static GroupValidator getServerView(GroupValidator gv)
      Wraps the GroupValidator so that only validations are visible that are active on the server. This way client-only validations are ignored.
    • getClientView

      public static GroupValidator getClientView(GroupValidator gv)
      Wraps the GroupValidator so that only validations are visible that are active on the client. This way server-only validations are ignored.
    • isMandatory

      public static boolean isMandatory(Iterable<Validator> iter)
      Tells if the field is mandatory (not 'blank').

      Takes only conditionless, error-level validators into account.

      Parameters:
      iter - An iteratable, for example a ValidatorGroup or a List.
      Returns:
      True if the field is mandatory.
    • getNumberRange

      public static Number[] getNumberRange(Iterable<Validator> iter)
    • allowNegativeNumber

      public static boolean allowNegativeNumber(Iterable<Validator> iter)
    • getLengthRange

      public static Integer[] getLengthRange(Iterable<Validator> iter)
    • getPostPointDigits

      public static Optional<Integer> getPostPointDigits(Iterable<Validator> iter)
    • getPrePointDigits

      public static Optional<Integer> getPrePointDigits(Iterable<Validator> iter)
    • getTextLength

      public static Optional<Integer> getTextLength(GroupValidator validator)
    • getRegExps

      public static Pattern[] getRegExps(Iterable<Validator> iter)