Add methods in KiwiConstraintViolations to convert Set<ConstraintViolation<T> to JDK Map and Guava Multimap.
Specifically, methods to convert a set of constraint violations to:
a Map<String, ConstraintViolation<T>> assuming there can only be a single violation per property. Throw an IllegalStateException if more than one violation for a property.
a Map<String, ConstraintViolation<T>>, ignoring more than one violation per property and taking the last violation when there is more than one for a property.
a Map<String, Set<ConstraintViolation<T>>> allowing for one or more violation per property.
a (Guava) Multimap<String, ConstraintViolation<T>> allowing for one or more violation per property.
There can be overloads of each of the above that accept a Function<Path, String> that specifies how to transform a property Path to a String. The default implementations can simply use Path::toString.
Add methods in
KiwiConstraintViolations
to convertSet<ConstraintViolation<T>
to JDKMap
and GuavaMultimap
.Specifically, methods to convert a set of constraint violations to:
Map<String, ConstraintViolation<T>>
assuming there can only be a single violation per property. Throw anIllegalStateException
if more than one violation for a property.Map<String, ConstraintViolation<T>>
, ignoring more than one violation per property and taking the last violation when there is more than one for a property.Map<String, Set<ConstraintViolation<T>>>
allowing for one or more violation per property.Multimap<String, ConstraintViolation<T>>
allowing for one or more violation per property.There can be overloads of each of the above that accept a
Function<Path, String>
that specifies how to transform a propertyPath
to aString
. The default implementations can simply usePath::toString
.