public Builder setMembersFromEnumTrait(EnumTrait trait, boolean synthesizeNames) {
            if (getId() == null) {
                throw new IllegalStateException("An id must be set before adding a named enum trait to a string.");
            }
            clearMembers();

            for (EnumDefinition definition : trait.getValues()) {
                Optional<MemberShape> member = EnumShape.memberFromEnumDefinition(definition, getId(), synthesizeNames);
                if (member.isPresent()) {
                    addMember(member.get());
                } else {
                    throw new IllegalStateException(String.format(
                            "Unable to convert enum trait entry with name: `%s` and value `%s` to an enum member.",
                            definition.getName().orElse(""),
                            definition.getValue()));
                }
            }

            return this;
        }
Sets enum members from an {@link EnumTrait}.

<p>This is primarily useful when converting from string shapes to enums.

@param trait The {@link EnumTrait} whose values should be converted to members.
@param synthesizeNames Whether to synthesize names if they aren't present in the enum trait.
@return Returns the builder.
smithy-model/src/main/java/software/amazon/smithy/model/shapes/EnumShape.java