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

io.oasp.module.beanmapping.common.impl.dozer.BeanMapperImplDozer Maven / Gradle / Ivy

Go to download

Minimal shim for bean mapping to convert between compatible Java beans (e.g. JPA entity to transfer-object and vice versa).

There is a newer version: 3.0.0
Show newest version
package io.oasp.module.beanmapping.common.impl.dozer;

import io.oasp.module.beanmapping.common.base.AbstractBeanMapper;

import javax.inject.Inject;
import javax.inject.Named;

import org.dozer.Mapper;

/**
 * This is the implementation of {@link io.oasp.module.beanmapping.common.api.BeanMapper} using dozer {@link Mapper}.
 *
 * @since 1.3.0
 */
@Named
public class BeanMapperImplDozer extends AbstractBeanMapper {

  /** The dozer instance to use. */
  private Mapper dozer;

  /**
   * The constructor.
   */
  public BeanMapperImplDozer() {

    super();
  }

  /**
   * @param dozer is the {@link Mapper} to {@link Inject}.
   */
  @Inject
  public void setDozer(Mapper dozer) {

    this.dozer = dozer;
  }

  @Override
  public  T map(Object source, Class targetClass) {

    if (source == null) {
      return null;
    }
    return this.dozer.map(source, targetClass);
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy