Package io.dropwizard.validation
Class ConstraintViolations
- java.lang.Object
-
- io.dropwizard.validation.ConstraintViolations
-
public class ConstraintViolations extends Object
This class provides static methods to work with constraint violations.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Set<javax.validation.ConstraintViolation<?>>copyOf(Set<javax.validation.ConstraintViolation<T>> violations)Copies a set ofConstraintViolations.static <T> Collection<String>format(Set<javax.validation.ConstraintViolation<T>> violations)Computes a set of formatted messages from the given typed set ofConstraintViolations.static <T> Stringformat(javax.validation.ConstraintViolation<T> v)Computes a string representation from aConstraintViolation.static Collection<String>formatUntyped(Set<javax.validation.ConstraintViolation<?>> violations)Computes a set of formatted messages from the given untyped set ofConstraintViolations.
-
-
-
Method Detail
-
format
public static <T> String format(javax.validation.ConstraintViolation<T> v)
Computes a string representation from aConstraintViolation.- Type Parameters:
T- the generic type of the constraint violation- Parameters:
v- the constraint violation- Returns:
- the formatted message
-
format
public static <T> Collection<String> format(Set<javax.validation.ConstraintViolation<T>> violations)
Computes a set of formatted messages from the given typed set ofConstraintViolations.- Type Parameters:
T- the generic type of the constraint violations- Parameters:
violations- the constraint violations to format- Returns:
- a new set containing the formatted messages
-
formatUntyped
public static Collection<String> formatUntyped(Set<javax.validation.ConstraintViolation<?>> violations)
Computes a set of formatted messages from the given untyped set ofConstraintViolations.- Parameters:
violations- the constraint violations to format- Returns:
- a new set containing the formatted messages
-
copyOf
public static <T> Set<javax.validation.ConstraintViolation<?>> copyOf(Set<javax.validation.ConstraintViolation<T>> violations)
Copies a set ofConstraintViolations.- Type Parameters:
T- the generic type of the constraint violations- Parameters:
violations- the source set- Returns:
- a new
HashSetcontaining the violations from the source set
-
-