public static M2tsEsRateInPes fromValue(String value) {
        if (value == null || "".equals(value)) {
            throw new IllegalArgumentException("Value cannot be null or empty!");
        }

        for (M2tsEsRateInPes enumEntry : M2tsEsRateInPes.values()) {
            if (enumEntry.toString().equals(value)) {
                return enumEntry;
            }
        }

        throw new IllegalArgumentException("Cannot create enum from " + value + " value!");
    }
Use this in place of valueOf.

@param value
       real value
@return M2tsEsRateInPes corresponding to the value

@throws IllegalArgumentException
        If the specified value does not map to one of the known values in this enum.
aws-java-sdk-medialive/src/main/java/com/amazonaws/services/medialive/model/M2tsEsRateInPes.java