It can't be done. As far as I can tell, the ordinal is generated by the compiler.
The work around would be as follows:
public enum MQAEnumState {
ACTIVE(1),
IN_ACTIVE(10),
NEW_USER(100);
private final int number;
private MQAEnumState(int number)
{
this.number = number;
}
public int getNumber()
{
return number;
}
}
All this does is add another field to the class, so you can access the number you wanted in your code.
But changing the ordinal itself? Can't be done. Note that the method is declared as 'final' in the Enum class, so there's no overriding it either.
Having looked at the @Enumeration annotation, I suspect that this won't actually work for you, but there we go.
[Message sent by forum member 'ipsi' (ipsi)]
http://forums.java.net/jive/thread.jspa?messageID=357828