/** 实例化并复制属性 */ public static final <T> T to(Object orig, Class<T> clazz) { T bean = null; try { bean = clazz.newInstance(); PropertyUtils.copyProperties(bean, orig); } catch (Exception e) { } return bean; }
public SharedDimensionGroup( ModelAnnotationGroup modelAnnotationGroup ) { super(); try { PropertyUtils.copyProperties( this, modelAnnotationGroup ); } catch ( Exception e ) { throw new RuntimeException( e ); } }
public static <T> T copyProperties(Class<T> dest, Object orig) { try { T result = dest.newInstance(); PropertyUtils.copyProperties(result, orig); return result; } catch (Exception e) { throw new ReflectionException(e); } }
public static void copyProperties(Object dest, Object orig){ try { org.apache.commons.beanutils.PropertyUtils.copyProperties(dest, orig); }catch(Exception e) { handleException(e); } }
/** * Copia as propriedades de um objeto para outro * * @param dest * @param orig */ public static <T> T copyProperties(T dest, Object orig) { try { PropertyUtils.copyProperties(dest, orig); } catch (Exception e) { throw new ReflectionException(e); } return dest; }
@JsonIgnore public Map<String, DQCategory> getDQCategoryMap() { Map<String, DQCategory> dqCategoryMap = new HashMap<>(); metadata.values().forEach(value -> { try { DQCategory dqCategory = new DQCategory(); PropertyUtils.copyProperties(dqCategory, value); dqCategoryMap.put(value.getId(), dqCategory); } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { LOGGER.error(e.getMessage(), e); } }); return dqCategoryMap; }
/** * Creates an {@link ExternalComment} based on the contents of the passed in {@link RemoteComment}. * * @param remoteComment the {@link RemoteComment} used for creation. Should not be null. * @return the created {@link ExternalComment} instance. */ public static ExternalComment createFrom(final RemoteComment remoteComment) { checkNotNull(remoteComment, "Remote comment should not be null"); final ExternalComment comment = new ExternalComment(); try { PropertyUtils.copyProperties(comment, remoteComment); } catch (Exception e) { log.error("Unable to create external comments from the remote comment"); throw new RuntimeException(e); } return comment; } }
public BroadcastMetadataObject(Map<String, DQCategory> dqCategoryMap) { metadata = new HashMap<>(); dqCategoryMap.values().forEach(value -> { DQCategoryForValidation dqCategoryForValidation = new DQCategoryForValidation(); try { PropertyUtils.copyProperties(dqCategoryForValidation, value); // clear children and refill List<DQCategory> sourceChildren = value.getChildren(); if (!CollectionUtils.isEmpty(sourceChildren)) { List<DQCategoryForValidation> copyChildren = new ArrayList<>(); for (DQCategory child : sourceChildren) { DQCategoryForValidation copyChild = new DQCategoryForValidation(); PropertyUtils.copyProperties(copyChild, child); copyChildren.add(copyChild); } dqCategoryForValidation.setChildren(copyChildren); } metadata.put(value.getId(), dqCategoryForValidation); } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { LOGGER.error(e.getMessage(), e); } }); }
public Object invoke(MethodInvocation invocation) throws Throwable { ActionMapping mapping = (ActionMapping) invocation.getArguments()[3]; String input = mapping.getInput(); if (input == null && S2StrutsContextUtil.getPreviousInputPath() != null) { ActionMapping newMapping = new ActionMapping(); try { PropertyUtils.copyProperties(newMapping, mapping); } catch (IllegalAccessException e) { throw new IllegalAccessRuntimeException(newMapping.getClass(), e); } catch (InvocationTargetException e) { throw new InvocationTargetRuntimeException(newMapping.getClass(), e); } catch (NoSuchMethodException e) { throw new NoSuchMethodRuntimeException(newMapping.getClass(), null, null, e); } input = S2StrutsContextUtil.getPreviousInputPath(); newMapping.setInput(input); invocation.getArguments()[3] = newMapping; } return invocation.proceed(); }
try { ProcessDBDictionary newDict = new ProcessDBDictionary(); PropertyUtils.copyProperties(newDict, oldDict); newDict.setId(null); PropertyUtils.copyProperties(newItem, item.getValue()); newItem.setId(null); PropertyUtils.copyProperties(newValue, value); newValue.setId(null); PropertyUtils.copyProperties(newExtension, extension.getValue()); newExtension.setId(null); PropertyUtils.copyProperties(newPermission, permission); newPermission.setId(null);
PropertyUtils.copyProperties(batch, bean); batch = batchDAO.create(batch); batch.setProduct(product);