Class ValidationUtils


  • public final class ValidationUtils
    extends java.lang.Object
    Utility methods used when validating.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T extends ToShapeId>
      java.util.Map<java.lang.String,​java.util.List<ShapeId>>
      findDuplicateShapeNames​(java.util.Collection<T> shapes)
      Find shape IDs in a collection that do not have case-insensitively unique member names.
      static java.lang.String orderedTickedList​(java.util.Collection<?> values)
      Creates a comma separated string made up of the given collection.
      static java.util.List<java.lang.String> splitCamelCaseWord​(java.lang.String word)
      Splits a camelCase word into a list of words.
      static java.lang.String tickedList​(java.util.Collection<?> values)
      Creates a comma separated string made up of the given collection.
      static java.lang.String tickedList​(java.util.stream.Stream<?> values)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • splitCamelCaseWord

        public static java.util.List<java.lang.String> splitCamelCaseWord​(java.lang.String word)
        Splits a camelCase word into a list of words.
        Parameters:
        word - Word to split.
        Returns:
        Returns the split words.
      • orderedTickedList

        public static java.lang.String orderedTickedList​(java.util.Collection<?> values)
        Creates a comma separated string made up of the given collection. Each value is surrounded by "`", and the values are sorted to make it easier to write tests against the messages.
        Parameters:
        values - Values to turn into a comma separated list.
        Returns:
        Returns the string.
      • tickedList

        public static java.lang.String tickedList​(java.util.Collection<?> values)
        Creates a comma separated string made up of the given collection. Each value is surrounded by "`", and the values are sorted to make it easier to write tests against the messages.
        Parameters:
        values - Values to turn into a comma separated list.
        Returns:
        Returns the string.
      • tickedList

        public static java.lang.String tickedList​(java.util.stream.Stream<?> values)
      • findDuplicateShapeNames

        public static <T extends ToShapeId> java.util.Map<java.lang.String,​java.util.List<ShapeId>> findDuplicateShapeNames​(java.util.Collection<T> shapes)
        Find shape IDs in a collection that do not have case-insensitively unique member names.

        The returned map is sorted by the conflicting name, and the list of conflicting shape values is also sorted to ensure that validation events can just print the map directly with consistent error messages.

        Type Parameters:
        T - The type of shape being checked.
        Parameters:
        shapes - Shapes collection to check.
        Returns:
        Returns a map that only contains the conflicting shapes.