Example usage for org.springframework.beans BeanUtils copyProperties

List of usage examples for org.springframework.beans BeanUtils copyProperties

Introduction

In this page you can find the example usage for org.springframework.beans BeanUtils copyProperties.

Prototype

public static void copyProperties(Object source, Object target) throws BeansException 

Source Link

Document

Copy the property values of the given source bean into the target bean.

Usage

From source file:com.jinmibao.common.util.BeanUtil.java

public static void copyProperties(Object source, Object target) {
    BeanUtils.copyProperties(source, target);
}

From source file:org.opensprout.osaf.util.WebServiceUtils.java

public static <T, S> T[] copyToDto(List<S> list, Class<T> dtoclass, T[] blankArray,
        CopyBeanToDtoTemplate<S, T> template) {
    List<T> dtos = new ArrayList<T>();
    for (S source : list) {
        T dto;/*from   w w  w.  j  a  v a 2  s .  co  m*/
        try {
            dto = (T) dtoclass.newInstance();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        BeanUtils.copyProperties(source, dto);
        if (template != null)
            template.copy(source, dto);
        dtos.add(dto);
    }

    return dtos.toArray(blankArray);
}

From source file:org.wallride.web.controller.admin.tag.TagCreateForm.java

public static TagCreateForm fromDomainObject(Category category) {
    TagCreateForm form = new TagCreateForm();
    BeanUtils.copyProperties(category, form);
    return form;/*from   ww  w  .  j  av a  2 s . c o m*/
}

From source file:org.wallride.web.controller.admin.tag.TagEditForm.java

public static TagEditForm fromDomainObject(Category category) {
    TagEditForm form = new TagEditForm();
    BeanUtils.copyProperties(category, form);
    return form;//  w  w w .j  av  a 2 s.c o  m
}

From source file:com.sap.csc.poc.ems.model.dto.entitlement.SoftwareLicenseEntitlementHistoryInfo.java

public SoftwareLicenseEntitlementHistoryInfo(SoftwareLicenseEntitlementHeaderHistory history) {
    if (history == null) {
        return;//from   ww w . jav  a 2 s . c om
    }
    BeanUtils.copyProperties(history, this);
}

From source file:com.sap.csc.poc.ems.model.dto.entitlement.SoftwareLicenseEntitlementItemInfo.java

public SoftwareLicenseEntitlementItemInfo(SoftwareLicenseEntitlementItem item) {
    if (item == null) {
        return;/*  w ww  .j a v  a 2 s  . c o  m*/
    }
    BeanUtils.copyProperties(item, this);
}

From source file:org.jumlabs.jcr.oak.rpc.util.RepositoryUtils.java

public static TTree toTTree(Tree tree) {
    TTree ttree = new TTree();
    BeanUtils.copyProperties(tree, ttree);
    ttree.setExists(tree.exists());/*w  w w . j a v  a2s.c  o m*/
    switch (tree.getStatus()) {
    case MODIFIED:
        ttree.setStatus(TTreeStatus.MODIFIED);
        break;
    case NEW:
        ttree.setStatus(TTreeStatus.NEW);
        break;
    case UNCHANGED:
        ttree.setStatus(TTreeStatus.UNCHANGED);
        break;
    }
    return ttree;
}

From source file:com.gooddata.auditevent.AuditEventPageRequest.java

/**
 * Copy constructor//from w  w  w . j a v a2  s.com
 *
 * @param source source object (not null) to create copy of
 * @return new instance, which fields has same value as fields of <code>source</code>
 */
public static AuditEventPageRequest copy(final AuditEventPageRequest source) {
    notNull(source, "source cannot be null");

    final AuditEventPageRequest copy = new AuditEventPageRequest();
    BeanUtils.copyProperties(source, copy);

    return copy;
}

From source file:com.kiroule.jpetstore.vaadinspring.domain.ShippingDetails.java

public ShippingDetails(BillingDetails billingDetails) {
    BeanUtils.copyProperties(billingDetails, this);
}

From source file:es.us.isa.governify.designer.modules.agreement.model.AbstractModuleManifest.java

@PostConstruct
void loadModule() {
    LOG.info("[IDEAS] Module is not loaded. Loading...");
    String json = Utils.loadFileContents(MANIFEST);
    Gson gson = new Gson();
    ModuleManifest module = gson.fromJson(json,
            es.us.isa.governify.designer.modules.agreement.model.ModuleManifest.class);
    BeanUtils.copyProperties(module, this);
}