src/main/java/org/xmlet/xsdparser/xsdelements/AttributeValidations.java
public static <T extends XsdEnum> T belongsToEnum(final XsdEnum<T> instance, final String value){
        if (value == null){
            return null;
        }

        Optional<T> enumValue = Arrays.stream(instance.getValues()).filter(enumField -> enumField.getValue().equals(value)).findFirst();

        if (enumValue.isPresent()){
            return enumValue.get();
        } else {
            StringBuilder possibleValues = new StringBuilder();

            instance.getSupportedValues().forEach(supportedValue -> possibleValues.append(supportedValue).append(", "));

            String values = possibleValues.toString();
            values = values.substring(0, values.length() - 2);

            throw new ParsingException("The attribute " + instance.getVariableName() + " doesn't support the value \"" + value + "\".\n" +
                    "The possible values for the " + instance.getVariableName() + " attribute are:\n" +
                    values);
        }
    }
public static <T extends XsdEnum> T belongsToEnum(final XsdEnum<T> instance, final String value){
        if (value == null){
            return null;
        }

        Optional<T> enumValue = Arrays.stream(instance.getValues()).filter(enumField -> enumField.getValue().equals(value)).findFirst();

        if (enumValue.isPresent()){
            return enumValue.get();
        } else {
            StringBuilder possibleValues = new StringBuilder();

            instance.getSupportedValues().forEach(supportedValue -> possibleValues.append(supportedValue).append(", "));

            String values = possibleValues.toString();
            values = values.substring(0, values.length() - 2);

            throw new ParsingException("The attribute " + instance.getVariableName() + " doesn't support the value \"" + value + "\".\n" +
                    "The possible values for the " + instance.getVariableName() + " attribute are:\n" +
                    values);
        }
    }
Verifies if a given value is present in a given {@link Enum} type.
@param instance An instance of the concrete {@link Enum} type that is expected to contain the {@code value} received.
@param value The value that is expected to be present in the received {@link Enum} type.
@param <T> The concrete type of the {@link Enum} type.
@return The instance of the concrete {@link Enum} type that represents {@code value} in the respective {@link Enum}.