List of usage examples for org.apache.commons.beanutils BeanMap getBean
public Object getBean()
From source file:com.github.jackygurui.vertxredissonrepository.repository.Impl.RedisRepositoryImpl.java
private T prepareInstanceAndFetchList(String id, RBatch redissonBatch, ArrayList<String> pList, String parent, Boolean deepFetch) throws InstantiationException, IllegalAccessException { BeanMap pMap = new BeanMap(cls.newInstance()); try {//from w w w . ja v a 2s . co m pMap.keySet().forEach(e -> { if ("class".equals(e)) { return; } Class type = pMap.getType(e.toString()); String fieldName = (parent == null ? "" : parent.concat(".")).concat(e.toString()); if (isRedisEntity(type)) { if (deepFetch) { try { RedisRepositoryImpl innerRepo = (RedisRepositoryImpl) factory.instance(type); pMap.put(e.toString(), innerRepo.prepareInstanceAndFetchList(id, redissonBatch, pList, fieldName, deepFetch)); } catch (InstantiationException | IllegalAccessException | RepositoryException ex) { throw new RuntimeException(ex); } } } else { if ("id".equals(e)) { redissonBatch.getMap(getStorageKey(), StringCodec.INSTANCE).getAsync(id); } else { redissonBatch.getMap(getStorageKey(e.toString())).getAsync(id); } pList.add(fieldName); } }); } catch (RuntimeException ex) { throw new InstantiationException(); } return (T) pMap.getBean(); }
From source file:org.dcm4chee.archive.patient.PatientSelectorFactory.java
private static PatientSelector createSelector(PatientSelectorConfig conf) { try {//from w ww . j a va2 s .c o m Object selectorObject = Class.forName(conf.getPatientSelectorClassName()).newInstance(); BeanMap map = new BeanMap(selectorObject); for (String key : conf.getPatientSelectorProperties().keySet()) map.put(key, conf.getPatientSelectorProperties().get(key)); return (PatientSelector) map.getBean(); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { throw new IllegalArgumentException("conf=" + conf, e); } }