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<jakarta.validation.ConstraintViolation<?>>
copyOf(Set<jakarta.validation.ConstraintViolation<T>> violations)
Copies a set ofConstraintViolations
.static <T> String
format(jakarta.validation.ConstraintViolation<T> v)
Computes a string representation from aConstraintViolation
.static <T> Collection<String>
format(Set<jakarta.validation.ConstraintViolation<T>> violations)
Computes a set of formatted messages from the given typed set ofConstraintViolations
.static Collection<String>
formatUntyped(Set<jakarta.validation.ConstraintViolation<?>> violations)
Computes a set of formatted messages from the given untyped set ofConstraintViolations
.
-
-
-
Method Detail
-
format
public static <T> String format(jakarta.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<jakarta.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<jakarta.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<jakarta.validation.ConstraintViolation<?>> copyOf(Set<jakarta.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
HashSet
containing the violations from the source set
-
-