Hello,

I'm trying to use RadioGroup with Enum values and getting
ClassCastException: java.lang.String cannot be cast to java.lang.Enum.

My page is as follows:

public class Page {

    private EnumValueEncoder<EnumType> enumTypeEncoder = new
EnumValueEncoder<EnumType>(EnumType.class);
    private EnumType enumType;

    public EnumType getEnumType() {
        return enumType;
    }

    public void setEnumType(EnumType enumType) {
        this.enumType = enumType;
    }

    public EnumValueEncoder<EnumType> getEnumTypeEncoder() {
        return enumTypeEncoder;
    }
}

public enum EnumType {
    A, B
}

<t:radiogroup t:id="enumType" t:encoder="enumTypeEncoder">
    <input t:type="radio" t:value="literal:A"/>
    <input t:type="radio" t:value="literal:B"/>
</t:radiogroup>

I supposed literal representation must be evaluated to corresponding
enum values and wise-versa, but I got a ClassCastException.

I found this way logical and I really don't want to use getters for
every element of enum. Is there any ways to achieve this?

Tapestry version is 5.0.15

Regards,
Alexey.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to