code2Name
定义注解

使用注解

枚举类中统一增加方法 getNameByCode

定义解析方法


可再优化的点
使用get和set方法获取和设置,避免直接从实例中取值和赋值
- 1、直接拼接get和set方法
- 2、使用
Introspector,支持isXxx - 3、使用 Spring的 BeanUtils,支持
isXxx
直接拼接get和set方法
String getName = "get" + Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1);
String setName = "set" + Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1);
使用 Introspector

使用 Spring的 BeanUtils
