public final class ValidationEvent extends java.lang.Object implements FromSourceLocation, java.lang.Comparable<ValidationEvent>, ToNode, software.amazon.smithy.utils.ToSmithyBuilder<ValidationEvent>
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.
| Modifier and Type | Class and Description |
|---|---|
static class |
ValidationEvent.Builder
Builds ValidationEvent values.
|
| Modifier and Type | Method and Description |
|---|---|
static ValidationEvent.Builder |
builder() |
int |
compareTo(ValidationEvent other) |
boolean |
containsId(java.lang.String id)
Tests if the event ID hierarchically contains the given ID.
|
boolean |
equals(java.lang.Object o) |
static ValidationEvent |
fromNode(Node node) |
static ValidationEvent |
fromSourceException(SourceException exception)
Creates a new ValidationEvent from a
SourceException. |
static ValidationEvent |
fromSourceException(SourceException exception,
java.lang.String prefix)
Creates a new ValidationEvent from a
SourceException. |
static ValidationEvent |
fromSourceException(SourceException exception,
java.lang.String prefix,
ShapeId shapeId)
Creates a new ValidationEvent from a
SourceException. |
java.lang.String |
getEventId()
Deprecated.
Use the
getId() method to match the node format. |
java.util.Optional<java.lang.String> |
getHint()
Get an optional hint that adds more detail about how to fix a specific issue.
|
java.lang.String |
getId()
Returns the identifier of the validation event.
|
java.lang.String |
getMessage() |
Severity |
getSeverity() |
java.util.Optional<ShapeId> |
getShapeId() |
SourceLocation |
getSourceLocation()
Gets the source location of a value.
|
java.util.Optional<java.lang.String> |
getSuppressionReason()
Get the reason that the event was suppressed.
|
int |
hashCode() |
ValidationEvent.Builder |
toBuilder() |
Node |
toNode()
Converts a value to a
Node. |
java.lang.String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitcomparepublic static ValidationEvent.Builder builder()
public static ValidationEvent fromSourceException(SourceException exception)
SourceException.exception - Exception to use to create the event.public static ValidationEvent fromSourceException(SourceException exception, java.lang.String prefix)
SourceException.exception - Exception to use to create the event.prefix - Prefix string to add to the message.public static ValidationEvent fromSourceException(SourceException exception, java.lang.String prefix, ShapeId shapeId)
SourceException.exception - Exception to use to create the event.prefix - Prefix string to add to the message.shapeId - ShapeId to associate with the event.public int compareTo(ValidationEvent other)
compareTo in interface java.lang.Comparable<ValidationEvent>public ValidationEvent.Builder toBuilder()
toBuilder in interface software.amazon.smithy.utils.ToSmithyBuilder<ValidationEvent>public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic static ValidationEvent fromNode(Node node)
public SourceLocation getSourceLocation()
FromSourceLocationgetSourceLocation in interface FromSourceLocationpublic java.lang.String getMessage()
public Severity getSeverity()
public java.lang.String getEventId()
getId() method to match the node format.The validation event identifier can be used to suppress events.
public boolean containsId(java.lang.String id)
Event IDs that contain dots (.) are hierarchical. An event ID of
"Foo.Bar" contains the ID "Foo" and "Foo.Bar".
However, an event ID of "Foo" does not contain the ID
"Foo.Bar" as "Foo.Bar" is more specific than "Foo".
If an event ID exactly matches the given id, then it also contains
the ID (for example, "Foo.Bar." contains "Foo.Bar.".
id - ID to test.id.public java.lang.String getId()
The validation event identifier can be used to suppress events.
public java.util.Optional<ShapeId> getShapeId()
public java.util.Optional<java.lang.String> getSuppressionReason()
public java.util.Optional<java.lang.String> getHint()