Class ValidationEvent

  • All Implemented Interfaces:
    java.lang.Comparable<ValidationEvent>, ToNode, software.amazon.smithy.utils.ToSmithyBuilder<ValidationEvent>

    public final class ValidationEvent
    extends java.lang.Object
    implements java.lang.Comparable<ValidationEvent>, ToNode, software.amazon.smithy.utils.ToSmithyBuilder<ValidationEvent>
    A validation event created when validating a model.

    Validation events are collection while assembling and validating a model. Events with a severity less than ERROR can be suppressed. All events contain a message, severity, and eventId.

    • Method Detail

      • fromSourceException

        public static ValidationEvent fromSourceException​(SourceException exception)
        Creates a new ValidationEvent from a SourceException.
        Parameters:
        exception - Exception to use to create the event.
        Returns:
        Returns a created validation event with an ID of Model.
      • fromSourceException

        public static ValidationEvent fromSourceException​(SourceException exception,
                                                          java.lang.String prefix)
        Creates a new ValidationEvent from a SourceException.
        Parameters:
        exception - Exception to use to create the event.
        prefix - Prefix string to add to the message.
        Returns:
        Returns a created validation event with an ID of Model.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

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

        public Node toNode()
        Description copied from interface: ToNode
        Converts a value to a Node.
        Specified by:
        toNode in interface ToNode
        Returns:
        Returns the creates Node.
      • getSourceLocation

        public SourceLocation getSourceLocation()
        Returns:
        The location at which the event occurred.
      • getMessage

        public java.lang.String getMessage()
        Returns:
        The human-readable event message.
      • getSeverity

        public Severity getSeverity()
        Returns:
        The severity level of the event.
      • getEventId

        public java.lang.String getEventId()
        Returns the identifier of the validation event.

        The validation event identifier can be used to suppress events.

        Returns:
        Returns the event ID.
      • getShapeId

        public java.util.Optional<ShapeId> getShapeId()
        Returns:
        The shape ID that is associated with the event.
      • getSuppressionReason

        public java.util.Optional<java.lang.String> getSuppressionReason()
        Get the reason that the event was suppressed.
        Returns:
        Returns the suppression reason if available.