java.lang.Object
software.amazon.smithy.model.validation.node.MemberAndShapeTraitPlugin<N,T>
- Type Parameters:
N- The type of the subclass ofNodethis plugin applies to.T- The type of the trait class this plugin applies to.
- All Implemented Interfaces:
NodeValidatorPlugin
- Direct Known Subclasses:
ConditionsTraitPlugin,UniqueItemsPlugin
public abstract class MemberAndShapeTraitPlugin<N extends Node,T extends Trait>
extends Object
implements NodeValidatorPlugin
An abstract base class for plugins that apply only to shapes with a given applied trait.
-
Nested Class Summary
Nested classes/interfaces inherited from interface software.amazon.smithy.model.validation.node.NodeValidatorPlugin
NodeValidatorPlugin.Context, NodeValidatorPlugin.Emitter -
Field Summary
Fields inherited from interface software.amazon.smithy.model.validation.node.NodeValidatorPlugin
EMPTY_STRING_ARRAY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidapplyMatching(Shape shape, Node value, NodeValidatorPlugin.Context context, NodeValidatorPlugin.Emitter emitter) Applies the plugin to the given shape, node value, and model.protected abstract voidcheck(Shape shape, T trait, N value, NodeValidatorPlugin.Context context, NodeValidatorPlugin.Emitter emitter) Validates the given node value.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.smithy.model.validation.node.NodeValidatorPlugin
apply, shapeTypeFilter
-
Constructor Details
-
MemberAndShapeTraitPlugin
- Parameters:
nodeClass- The subclass ofNodethis plugin applies to.traitClass- The trait class this plugin applies to.
-
-
Method Details
-
applyMatching
public final void applyMatching(Shape shape, Node value, NodeValidatorPlugin.Context context, NodeValidatorPlugin.Emitter emitter) Description copied from interface:NodeValidatorPluginApplies the plugin to the given shape, node value, and model. Requires the shape to match the shapeMatcher().- Specified by:
applyMatchingin interfaceNodeValidatorPlugin- Parameters:
shape- Shape being checked.value- Value being evaluated.context- Evaluation context.emitter- Consumer to notify of validation event locations and messages.
-
check
protected abstract void check(Shape shape, T trait, N value, NodeValidatorPlugin.Context context, NodeValidatorPlugin.Emitter emitter) Validates the given node value.Implementors can assume the given trait is applied to the given shape.
- Parameters:
shape- The shape the given value is for.trait- The applied trait on the given shape.value- TheNodevalue to validate.context- The plugin validation context.emitter- The emitter to emit any validation events that occur.
-