Instead of hardcoding the names of the bean properties as a string in the mappings, MentaBean provides a proxy implementation that allows you to configure the property name through code. Therefore, if you later refactor the name of the property, you won't need to remember to change the name in the mappings too. See the example below:
// hardcoded approach: (no support for refactoring) BeanConfig config = new BeanConfig(User.class, "Users"); config.pk("id", DBTypes.AUTOINCREMENT); config.field("username", DBTypes.STRING); config.field("birthdate", "bd", DBTypes.DATE); // note that the database column name is different config.field("status", DBTypes.ENUMVALUE.from(User.Status.class)); config.field("deleted", DBTypes.BOOLEANINT); config.field("insertTime", "insert_time", DBTypes.NOW_ON_INSERT_TIMESTAMP); // proxy appraoch: (support for refactoring) BeanConfig config = new BeanConfig(User.class, "Users"); User userProps = PropertiesProxy.create(User.class); config.pk(userProps.getId(), DBTypes.AUTOINCREMENT); config.field(userProps.getUsername(), DBTypes.STRING); config.field(userProps.getBirthdate(), "bd", DBTypes.DATE); // note that the database column name is different config.field(userProps.getStatus(), DBTypes.ENUMVALUE.from(User.Status.class)); config.field(userProps.isDeleted(), DBTypes.BOOLEANINT); config.field(userProps.getInsertTime(), "insert_time", DBTypes.NOW_ON_INSERT_TIMESTAMP);
NOTE: In case you are curious about how this is done, take a look in the PropertiesProxy source code. It basically uses Javassist to intercept the calls to the getters in order to save the property name for the mapping method that will come right after the getter.