Class Suppression
- java.lang.Object
-
- software.amazon.smithy.model.validation.Suppression
-
- All Implemented Interfaces:
FromSourceLocation
,software.amazon.smithy.utils.ToSmithyBuilder<Suppression>
public final class Suppression extends java.lang.Object implements FromSourceLocation, software.amazon.smithy.utils.ToSmithyBuilder<Suppression>
Validator suppression.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Suppression.Builder
Builder used to create suppression definitions.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Suppression.Builder
builder()
java.util.Set<java.lang.String>
getNamespaceNames()
java.util.Optional<java.lang.String>
getReason()
java.util.Set<ShapeId>
getShapes()
SourceLocation
getSourceLocation()
Gets the source location of a value.java.util.Set<java.lang.String>
getValidatorIds()
ValidationEvent
suppress(ValidationEvent event)
Given an event returns a mapped event that is either the same event or a suppressed version of it.static ValidationEvent
suppressEvent(ValidationEvent validationEvent, java.util.List<Suppression> suppressions)
Applies a list of suppressions to a validation event.Suppression.Builder
toBuilder()
java.lang.String
toString()
-
-
-
Method Detail
-
builder
public static Suppression.Builder builder()
-
toBuilder
public Suppression.Builder toBuilder()
- Specified by:
toBuilder
in interfacesoftware.amazon.smithy.utils.ToSmithyBuilder<Suppression>
-
suppressEvent
public static ValidationEvent suppressEvent(ValidationEvent validationEvent, java.util.List<Suppression> suppressions)
Applies a list of suppressions to a validation event.
Suppressions are applied, in order, until the event is marked as suppressed or there are no more suppressions to apply. The list of suppressions is short-circuited as soon as the first suppression suppresses the event.
- Parameters:
validationEvent
- Validation event to suppress if needed.suppressions
- Ordered list of suppressions to apply.- Returns:
- Returns the event that is mapped over by the list of suppressions.
-
getReason
public java.util.Optional<java.lang.String> getReason()
- Returns:
- Returns the optional reason string.
-
getValidatorIds
public java.util.Set<java.lang.String> getValidatorIds()
- Returns:
- Returns the list of validator IDs.
-
getShapes
public java.util.Set<ShapeId> getShapes()
- Returns:
- Returns the possibly empty list of shapes to suppress.
-
getNamespaceNames
public java.util.Set<java.lang.String> getNamespaceNames()
- Returns:
- Returns the namespaces that are suppressed.
-
suppress
public ValidationEvent suppress(ValidationEvent event)
Given an event returns a mapped event that is either the same event or a suppressed version of it.- Parameters:
event
- Event to map over.- Returns:
- Returns the suppressed event or the original event.
-
getSourceLocation
public SourceLocation getSourceLocation()
Description copied from interface:FromSourceLocation
Gets the source location of a value.- Specified by:
getSourceLocation
in interfaceFromSourceLocation
- Returns:
- Returns the source location of the value.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-