publicissapient-france / selma

Selma Java bean mapping that compiles
http://selma-java.org
Apache License 2.0
213 stars 38 forks source link

Selma doesn't map Enum to string #208

Open sebvelay opened 5 years ago

sebvelay commented 5 years ago

Hello,

I notice Selma can't automatically map a String to an Enum or an Enum to a String. We have to create a CustomMapper to do something like that :

    public String enumToString(MyEnum e) {
        return e.toString();
    }

    public MyEnum stringToEnum(String s) {
        return MyEnum.valueOf(s);
    }

This is useless code, so I suggest to add this as a feature in Selma. I can try to do it, if someone can review PR.

BR