GenericPropertyEditor도 만들었었는데 Formatter라고 못만들까 하는 생각에 만들어봤습니다. Locale은 무시해서;; 반쪽짜리긴 하지만 그래도 쓸만합니다.

포매터를 만들 대상은 PersuistentEnum 입니다. 자세한 내용은 이전 글에서 확인하시기 바랍니다.
http://whiteship.me/search/PersistentEnum
간단히.. Enum을 사용할 떄 필요한 기능을 정의한 PersistentEnum 인터페이스를 사용할 때 필요한 UserType이나 Formatter를 쉽게 만들 수 있게 GenericPersistentEnumUserType GenericPersistentEnumProperyEditor등을 만들었습니다.
public class PersistentEnumFormatter<E extends PersistentEnum> implements Formatter<E> {
    protected Class<E> enumClass;
@SuppressWarnings("unchecked")
public PersistentEnumFormatter() {
ParameterizedType genericSuperclass = (ParameterizedType) getClass()
.getGenericSuperclass();
Type type = genericSuperclass.getActualTypeArguments()[0];
if (type instanceof ParameterizedType) {
this.enumClass = (Class) ((ParameterizedType) type).getRawType();
} else {
this.enumClass = (Class) type;
}
}
    
    public String print(E object, Locale locale) {
        return object.getDescr();
    }
    public E parse(String text, Locale locale) throws ParseException {
        return PersistentEnumUtil.valueOf(enumClass, Integer.parseInt(text));
    }
}
제네릭 타입이 필요해서 생성자에서 타입 추론을 사용했는데 그 코드만 빼면 너무도 간단합니다. PE 만들때랑 비슷하거나 더 쉬운것 같습니다.
그래도 왠지 불안하니깐 테스트 해봤습니다.
public class PersistentEnumFormatterTest {
    CodeCateFormatter ccf;
    @Before
    public void setUp(){
        ccf = new CodeCateFormatter();
    }
    @Test
    public void testPrint() throws Exception {
        assertThat(ccf.print(CodeCate.SIZE, null), is("사이즈"));
    }
    @Test
    public void testParse() throws Exception {
        assertThat(ccf.parse("10", null), is(CodeCate.COLOR));
    }
    @Test
    public void testParseNotInValue() throws Exception {
        assertThat(ccf.parse("0", null), is(nullValue()));
    }
    @Test(expected = NumberFormatException.class)
    public void testParseWrongValue() throws Exception {
        assertThat(ccf.parse("캐스팅에러", null), is(nullValue()));
    }
    class CodeCateFormatter extends PersistentEnumFormatter<CodeCate> {
    }
}
흠냐 이제 포매터로 갈아탈 시간이 됐군요. 
어서 CodeCate 이늄(enum)좀 추가하고 마무리 해야겠어요.