org.hibernate.validator.internal.constraintvalidators

## Class SizeValidatorForCharSequence

- java.lang.Object
- - org.hibernate.validator.internal.constraintvalidators.SizeValidatorForCharSequence

- All Implemented Interfaces:
    ConstraintValidator<Size,CharSequence>

      public class SizeValidatorForCharSequence
      extends Object
      implements ConstraintValidator<Size,CharSequence>

  Check that the length of a character sequence is between min and max.
  Author:
    Emmanuel Bernard, Gavin King, Hardy Ferentschik

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SizeValidatorForCharSequence()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `initialize(Size parameters)`
    `boolean` | `isValid(CharSequence charSequence, ConstraintValidatorContext constraintValidatorContext)` Checks the length of the specified character sequence (e.g.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SizeValidatorForCharSequence

          public SizeValidatorForCharSequence()

  - ### Method Detail

    - #### initialize

          public void initialize(Size parameters)

      Specified by:
        `initialize` in interface `ConstraintValidator<Size,CharSequence>`

    - #### isValid

          public boolean isValid(CharSequence charSequence,
                        ConstraintValidatorContext constraintValidatorContext)

      Checks the length of the specified character sequence (e.g. string).
      Specified by:
        `isValid` in interface `ConstraintValidator<Size,CharSequence>`
      Parameters:
        `charSequence` - The character sequence to validate.
        `constraintValidatorContext` - context in which the constraint is evaluated.
      Returns:
        Returns `true` if the string is `null` or the length of `charSequence` between the specified `min` and `max` values (inclusive), `false` otherwise.

Copyright © 2007-2014 Red Hat, Inc. All Rights Reserved