Class MemberAndShapeTraitPlugin<N extends Node,T extends Trait>

java.lang.Object
software.amazon.smithy.model.validation.node.MemberAndShapeTraitPlugin<N,T>
Type Parameters:
N - The type of the subclass of Node this 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.
  • Constructor Details

    • MemberAndShapeTraitPlugin

      public MemberAndShapeTraitPlugin(Class<N> nodeClass, Class<T> traitClass)
      Parameters:
      nodeClass - The subclass of Node this 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: NodeValidatorPlugin
      Applies the plugin to the given shape, node value, and model. Requires the shape to match the shapeMatcher().
      Specified by:
      applyMatching in interface NodeValidatorPlugin
      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 - The Node value to validate.
      context - The plugin validation context.
      emitter - The emitter to emit any validation events that occur.