Class ValidationUtils


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

      All Methods Static Methods Concrete Methods Deprecated 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)
      Deprecated.
      static boolean isCriticalEvent​(java.lang.String eventId)
      Checks if the given validation event was emitted by a critical validator.
      static boolean isCriticalValidator​(java.lang.Class<? extends Validator> validator)
      Checks if the given validator class is a critical validator that should be applied before other downstream validators are applied.
      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)  
      static java.lang.String tickedPrettyPrintedNode​(Node node)
      Writes the contents of a Node to a pretty-printed JSON string surrounded in backticks.
      • Methods inherited from class java.lang.Object

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

      • isCriticalValidator

        public static boolean isCriticalValidator​(java.lang.Class<? extends Validator> validator)
        Checks if the given validator class is a critical validator that should be applied before other downstream validators are applied.
        Parameters:
        validator - Validator class to check.
        Returns:
        Returns true if the given validator is considered a critical validator.
      • isCriticalEvent

        public static boolean isCriticalEvent​(java.lang.String eventId)
        Checks if the given validation event was emitted by a critical validator.
        Parameters:
        eventId - Event ID to check if it's a critical validation event.
        Returns:
        Returns true if the given event was emitted from a critical validator.
      • 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)
      • tickedPrettyPrintedNode

        public static java.lang.String tickedPrettyPrintedNode​(Node node)
        Writes the contents of a Node to a pretty-printed JSON string surrounded in backticks.
        Parameters:
        node - Node to write.
        Returns:
        Returns a string suitable for Markdown rendering.
      • findDuplicateShapeNames

        @Deprecated
        public static <T extends ToShapeId> java.util.Map<java.lang.String,​java.util.List<ShapeId>> findDuplicateShapeNames​(java.util.Collection<T> shapes)
        Deprecated.