All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.asu.diging.gilesecosystem.util.store.objectdb.PropertiesCopier Maven / Gradle / Ivy

Go to download

Utility plugin for the Giles Ecoystem that for example provides utility classes for properties or file management.

The newest version!
package edu.asu.diging.gilesecosystem.util.store.objectdb;

import java.lang.reflect.Field;

import org.springframework.stereotype.Service;
import org.springframework.util.ReflectionUtils;
import org.springframework.util.ReflectionUtils.FieldCallback;

import edu.asu.diging.gilesecosystem.util.store.IPropertiesCopier;

@Service
public class PropertiesCopier implements IPropertiesCopier {

    /* (non-Javadoc)
     * @see edu.asu.diging.gilesecosystem.web.service.impl.IPropertiesCopier#copyObject(java.lang.Object, java.lang.Object)
     */
    @Override
    public void copyObject(Object objectToCopy, Object copyInto) {
        ReflectionUtils.doWithFields(objectToCopy.getClass(), new FieldCallback() {
            
            @Override
            public void doWith(Field field) throws IllegalArgumentException,
                    IllegalAccessException {
                field.setAccessible(true);
                ReflectionUtils.setField(field, copyInto, ReflectionUtils.getField(field, objectToCopy));
            }
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy