Menu

#22 use toString() rather than name() for EnumTransformer

open
nobody
5
2011-10-05
2011-10-05
Anonymous
No

It is better use toString() for displaying the name of enum because the name() method in Enum class is declared as final

Please change the EnumTransformer like this:

public class EnumTransformer extends AbstractTransformer {

public void transform(Object object) {
getContext().writeQuoted(((Enum) object).toString());
}

}

Discussion


Log in to post a comment.