Class ValidationContext


  • public final class ValidationContext
    extends java.lang.Object
    This class helps to describe location of problems found by validators. Typical usage:
    • no context of an error:
      ValidationContext.empty()
    • a single element:
      ValidationContext.of("key")
    • a nested hierarchy:
      ValidationContext.of("Plan P").with("Stage 1").with("Job A").with("name")
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean contains​(java.lang.String element)
      Returns true if context contains the given element.
      static ValidationContext empty()
      Returns an empty context.
      boolean isEmpty()
      Returns true if context is empty.
      static ValidationContext of​(@NotNull java.lang.String context)
      Returns a single-element context.
      java.lang.String toString()  
      ValidationContext with​(@NotNull java.lang.String context)
      Returns new instance of validation context with the context element appended to it.
      • Methods inherited from class java.lang.Object

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

      • empty

        public static ValidationContext empty()
        Returns an empty context.
        Returns:
        ValidationContext
      • of

        public static ValidationContext of​(@NotNull
                                           @NotNull java.lang.String context)
        Returns a single-element context.
        Parameters:
        context - name
        Returns:
        ValidationContext
      • with

        public ValidationContext with​(@NotNull
                                      @NotNull java.lang.String context)
        Returns new instance of validation context with the context element appended to it.
        Parameters:
        context - name
        Returns:
        ValidationContext
      • isEmpty

        public boolean isEmpty()
        Returns true if context is empty.
        Returns:
        boolean
      • contains

        public boolean contains​(java.lang.String element)
        Returns true if context contains the given element.
        Returns:
        boolean
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object