How to convert String to java enum value?

In my java spring application I use the ratings of several rating agencies.
So for each rating agency I defined an enum containing the different ratings used by the agency.

Here is an example of such an enum (for rating agency “CRAG”):

public enum RatingsCRAG {

    AAA("AAA"),
    AAplus("AA+"),
    AA("AA"),
    AAminus("AA-"),
    Aplus("A+"),
    A("A"),
    Aminus("A-"),
    BBBplus("BBB+"),
    BBB("BBB"),
    BBBminus("BBB-"),
    BBplus("BB+"),
    BB("BB"),
    BBminus("BB-"),
    Bplus("B+"),
    B("B"),
    Bminus("B-"),
    CCC("CCC"),
    CC("CC"),
    C("C"),
    D("D");

    private String value;
    RatingsCRAG(String value) {
        this.value = value;
    }

    @Override
    public String toString() {
        return this.value;
    }

}

The class “Counterparty” has several attributes, one of them is the CRAG-rating:

@Entity
@Table(name="Counterparties")
public class Counterparty {

    @Id
    @Column(name="id")
    private int id;

    @Column(name="name")
    private String name;

    @Enumerated(EnumType.STRING)
    @Column(name="rating_crag")
    private RatingsCRAG ratingCRAG;

  //...more attributes and getters and setters 

The reason why (in the RatingsCRAG enum definition) I put a value in brackets behind each value is this:

The values in brackets (e.g. (“BBB-“) behind BBBminus or (“BB+”) behind BBplus) are the actual ratings, which are supposed to be in the database.

That is, in the database should be the value “BBB-” instead of “BBBminus” and (and “BB+” instead of “BBplus”, etc.).

I hoped this would be achieved by putting the actual values behind the Java enum values. (It’s not possible to use, e.g., an enum value of “BBB-” in the java code, only something like “BBBminus” is possible).

However, when I want to read xml data of the following format:

<Counterparty id="1" name="XYZ Bank" ratingCRAG="BBB-" ..... />

into the database, I get the following error message:

java.lang.IllegalArgumentException: No enum constant com.app.utils.RatingsCRAG.BBB- 

This error message is thrown by the following line in the SAXHandler used to read the xml-data into the database:

@SpringComponent
public class SAXHandler extends DefaultHandler {

@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {

    if (qName.equalsIgnoreCase("Counterparty")) {

        ... 
// error is thrown by the following line:
        RatingsCRAG ratingCRAG = RatingsCRAG.valueOf(attributes.getValue("ratingCRAG"));


       ...  

The program expects “BBBminus” but gets “BBB-”

Based on this post:

How to convert string value into Enum in Java?

… I thought that using

RatingsCRAG.valueOf("BBB-")

would result in “BBBminus” but apparently this does not work.

So my question is:

How can I convert a String such as “BBB-” to the corresponding enum value (in this case “BBBminus”).

Is there some special function to be used (instead of the valueOf()-function) or is there some annotation I have to include in the enum definition?

Help would be much appreciated.