Copies the atributes from an obj to a destination obj

@param sourceResource                source resource obj
@param destinationResource           destination resource obj
@param <T>
@return
@throws MPException
1785
private static <T extends MPBase> T fillResource(T sourceResource, T destinationResource) throws MPException {
        Field[] declaredFields = destinationResource.getClass().getDeclaredFields();
        for (Field field : declaredFields) {
            try {
                Field originField = sourceResource.getClass().getDeclaredField(field.getName());
                field.setAccessible(true);
                originField.setAccessible(true);
                field.set(destinationResource, originField.get(sourceResource));

            } catch (Exception ex) {
                throw new MPException(ex);
            }
        }
        return destinationResource;
    }
329928
public static Path copy(Path sourcePath, Path destinationPath,
            CopyOption... options) {
        return operate(sourcePath, destinationPath, "copy", finalPath -> {
            try {
                return Files.copy(sourcePath, finalPath, options);
            } catch (Exception e) {
                return JMExceptionManager.handleExceptionAndReturnNull(log, e,
                        "copy", sourcePath, destinationPath, options);
            }
        });
    }
1342643
public void copyResource(String name, String destinationFilename) {
        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        if (classLoader == null) {
            String error = "Can not obtain classloader instance";
            throw new IllegalStateException(error);
        }
        try (InputStream stream = classLoader.getResourceAsStream(name)) {
            if (stream == null) {
                String error = "Could not copy file, source file not found: " + name;
                throw new IllegalStateException(error);
            }
            Path path = Paths.get(destinationFilename);
            FileUtils.copyInputStreamToFile(stream, path.toFile());
        } catch (IOException e) {
            throw new GeneratorException("Could not copy %s", e, name);
        }
    }
985915
protected void copyProperties(Object dest, Object source) {
        try {
            BeanUtils.copyProperties(dest, source);
        } catch (Exception e) {
            String errorMessage = MessageFormat.format("M:{0};;E:{1}",
                    e.getCause().getMessage(), e.toString());
            throw new WebApplicationException(errorMessage, Status.BAD_REQUEST);
        }
    }
1019744
public static void copyProperties(final Object source, final Object target) {

        ExceptionUtils.iae.throwIfNull(source, SOURCE_IS_NULL_MESSAGE);
        ExceptionUtils.iae.throwIfNull(target, TARGETIS_NULL_MESSAGE);
        Class<Object> sourceClass = ClassUtils.getClass(source);
        Class<Object> targetClass = ClassUtils.getClass(target);
        Field[] sourceFields = sourceClass.getDeclaredFields();
        Field[] targetFields = targetClass.getDeclaredFields();
        try {
            for (Field sourceField : sourceFields) {
                Field targetField = getFieldByField(targetFields, sourceField);
                if (targetField != null) {
                    getAndSetValue(source, sourceField, target, targetField);
                }
            }
        } catch (Exception e) {
            throw new FatalBeanException(CAN_NOT_COPY_PROPERTIES, e);
        }
    }
150252
public static SourceMapGenerator fromSourceMap(SourceMapConsumer aSourceMapConsumer) {
        String sourceRoot = aSourceMapConsumer.sourceRoot;
        SourceMapGenerator generator = new SourceMapGenerator(aSourceMapConsumer.file, sourceRoot);
        aSourceMapConsumer.eachMapping().forEach(mapping -> {
            Mapping newMapping = new Mapping(mapping.generated);
            if (mapping.source != null) {
                newMapping.source = mapping.source;
                if (sourceRoot != null) {
                    newMapping.source = Util.relative(sourceRoot, newMapping.source);
                }
                newMapping.original = mapping.original;
                if (mapping.name != null) {
                    newMapping.name = mapping.name;
                }
            }
            generator.addMapping(newMapping);
        });
        aSourceMapConsumer.sources().stream().forEach(sourceFile -> {
            String content = aSourceMapConsumer.sourceContentFor(sourceFile, null);
            if (content != null) {
                generator.setSourceContent(sourceFile, content);
            }
        });
        return generator;
    }
154258
public function copyFrom($sourceModel, $destinationModel)
    {
        $this->guardProviderNames($sourceModel);
        $this->guardProviderNames($destinationModel);

        $setters = $this->getSetters();

        if (empty($setters) || !\is_array($setters)) {
            throw new DcGeneralRuntimeException(
                \sprintf(
                    'No relationship setter defined from %s to %s.',
                    $this->getSourceName(),
                    $this->getDestinationName()
                )
            );
        }

        foreach ($setters as $setter) {
            if (!$this->isValidSetter($setter)) {
                throw new DcGeneralRuntimeException(
                    \sprintf(
                        'Invalid relationship setter entry, ensure it is an array containing only "to_field" and
                    one of "from_field", "value": %s',
                        \var_export($setter, true)
                    )
                );
            }

            if (isset($setter['from_field'])) {
                $destinationModel->setProperty($setter['to_field'], $sourceModel->getProperty($setter['to_field']));

                continue;
            }

            $destinationModel->setProperty($setter['to_field'], $setter['value']);
        }
    }
538129
private Method getPropertySourceMethod(Object sourceObject,
			Object destinationObject, String destinationProperty) {
		BeanToBeanMapping beanToBeanMapping = beanToBeanMappings.get(ClassPair
				.get(sourceObject.getClass(), destinationObject
						.getClass()));
		String sourceProperty = null;
		if (beanToBeanMapping != null) {
			sourceProperty = beanToBeanMapping
					.getSourceProperty(destinationProperty);
		}
		if (sourceProperty == null) {
			sourceProperty = destinationProperty;
		}

		return BeanUtils.getGetterPropertyMethod(sourceObject.getClass(),
				sourceProperty);
	}
220852
public static void copySubtree(@NotNull Resource targetParent, @NotNull Resource source) {
    Resource targetChild = GraniteUiSyntheticResource.child(targetParent, source.getName(), source.getResourceType(), source.getValueMap());
    for (Resource sourceChild : source.getChildren()) {
      copySubtree(targetChild, sourceChild);
    }
  }
268487
public static <T> T copy(final T object, final DataTypeDescriptor<T> descriptor) {
		if (descriptor == null) {
			throw new NullPointerException("descriptor");
		}

		return copy(object, descriptor.getType());
	}
1057854
public void copyResources(String outputFolder) {

        logger.entering(new Object[] { outputFolder });

        copyResource(outputFolder, "RuntimeReporterResources.properties");
        copyResource(outputFolder, "Resources.properties");

        logger.exiting();
    }
223851
protected void copyErrors(ActionBeanContext source, ActionBeanContext destination) {
        destination.getValidationErrors().putAll(source.getValidationErrors());
    }
965517
public static void copyProperties(Object source, Object target, CopyOptions copyOptions) {
		if (null == copyOptions) {
			copyOptions = new CopyOptions();
		}
		BeanCopier.create(source, target, copyOptions).copy();
	}
748864
@Override
  public AsyncHttpWriterBuilder<D, RQ, RP> writeTo(Destination destination) {
    super.writeTo(destination);
    return fromState(destination.getProperties());
  }
1255656
public void copy(ConnectionContext source) {
        this.connection = source.connection;
        this.session = source.session;
        this.destination = source.destination;
    }
665451
public static DataBinding map( Object source, Object destination )
	{
		return bindObject( source ).mapTo( destination );
	}
1307710
public static void copyInstanceResources( Instance instance, Map<String,byte[]> fileNameToFileContent )
	throws IOException {

		File dir = InstanceHelpers.findInstanceDirectoryOnAgent( instance );
		Utils.createDirectory( dir );

		if( fileNameToFileContent != null ) {
			for( Map.Entry<String,byte[]> entry : fileNameToFileContent.entrySet()) {

				File f = new File( dir, entry.getKey());
				Utils.createDirectory( f.getParentFile());

				ByteArrayInputStream in = new ByteArrayInputStream( entry.getValue());
				Utils.copyStream( in, f );
			}
		}
	}