@Override
    public List<ValidationEvent> validate(Model model) {
        // Find all traits that are exclusive by member and target.
        Set<ShapeId> exclusiveMemberTraits = new HashSet<>();
        Set<ShapeId> exclusiveTargetTraits = new HashSet<>();

        for (Shape shape : model.getShapesWithTrait(TraitDefinition.class)) {
            TraitDefinition definition = shape.expectTrait(TraitDefinition.class);
            if (definition.isStructurallyExclusiveByTarget()) {
                exclusiveTargetTraits.add(shape.getId());
            } else if (definition.isStructurallyExclusiveByMember()) {
                exclusiveMemberTraits.add(shape.getId());
            }
        }

        List<ValidationEvent> events = new ArrayList<>();
        for (Shape shape : model.getStructureShapes()) {
            validateExclusiveMembers(shape, exclusiveMemberTraits, events);
            validateExclusiveTargets(model, shape, exclusiveTargetTraits, events);
        }

        return events;
    }
Validates traits that can only be applied to a single structure member.
smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/ExclusiveStructureMemberTraitValidator.java