/** * <p>Initialize filler for given object class.</p> * @param pClass object class * @throws Exception - an exception **/ public final synchronized void init(final Class<T> pClass) throws Exception { this.objectClass = pClass; this.fieldsNames.clear(); this.gettersMap.clear(); this.settersMap.clear(); Field[] fields = getUtlReflection().retrieveFields(this.objectClass); for (Field field : fields) { Method getter = getUtlReflection() .retrieveGetterForField(pClass, field.getName()); Method setter = getUtlReflection() .retrieveSetterForField(pClass, field.getName()); this.gettersMap.put(field.getName(), getter); this.settersMap.put(field.getName(), setter); this.fieldsNames.add(field.getName()); } }
/** * <p>It must be invoked at once by Factory to improve performance * by not using locking during usage this converter.</p> * @param pClass entity class * @param pIdName entity ID name * @throws Exception - an exception **/ public final void init(final Class<T> pClass, final String pIdName) throws Exception { this.entityClass = pClass; this.getterId = getUtlReflection() .retrieveGetterForField(this.entityClass, pIdName); this.setterId = getUtlReflection() .retrieveSetterForField(this.entityClass, pIdName); }