org.dozer.Mapper.map()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中org.dozer.Mapper.map()方法的一些代码示例,展示了Mapper.map()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mapper.map()方法的具体详情如下:
包路径:org.dozer.Mapper
类名称:Mapper
方法名:map

Mapper.map介绍

[英]Constructs new instance of destinationClass and performs mapping between from source
[中]构造destinationClass的新实例,并在源代码之间执行映射

代码示例

代码示例来源:origin: vipshop/vjtools

/**
 * 简单的复制出新类型对象.
 */
public static <S, D> D map(S source, Class<D> destinationClass) {
  return mapper.map(source, destinationClass);
}

代码示例来源:origin: springside/springside4

/**
 * 简单的复制出新类型对象.
 */
public static <S, D> D map(S source, Class<D> destinationClass) {
  return mapper.map(source, destinationClass);
}

代码示例来源:origin: springside/springside4

/**
 * 简单的复制出新对象ArrayList
 */
public static <S, D> List<D> mapList(Iterable<S> sourceList, Class<D> destinationClass) {
  List<D> destionationList = new ArrayList<D>();
  for (S source : sourceList) {
    if (source != null) {
      destionationList.add(mapper.map(source, destinationClass));
    }
  }
  return destionationList;
}

代码示例来源:origin: vipshop/vjtools

/**
 * 简单的复制出新对象ArrayList
 */
public static <S, D> List<D> mapList(Iterable<S> sourceList, Class<D> destinationClass) {
  List<D> destinationList = new ArrayList<D>();
  for (S source : sourceList) {
    if (source != null) {
      destinationList.add(mapper.map(source, destinationClass));
    }
  }
  return destinationList;
}

代码示例来源:origin: springside/springside4

/**
   * 简单复制出新对象数组
   */
  public static <S, D> D[] mapArray(final S[] sourceArray, final Class<D> destinationClass) {
    D[] destinationArray = ArrayUtil.newArray(destinationClass, sourceArray.length);

    int i = 0;
    for (S source : sourceArray) {
      if (source != null) {
        destinationArray[i] = mapper.map(sourceArray[i], destinationClass);
        i++;
      }
    }

    return destinationArray;
  }
}

代码示例来源:origin: vipshop/vjtools

/**
   * 简单复制出新对象数组
   */
  public static <S, D> D[] mapArray(final S[] sourceArray, final Class<D> destinationClass) {
    D[] destinationArray = ArrayUtil.newArray(destinationClass, sourceArray.length);

    int i = 0;
    for (S source : sourceArray) {
      if (source != null) {
        destinationArray[i] = mapper.map(sourceArray[i], destinationClass);
        i++;
      }
    }

    return destinationArray;
  }
}

代码示例来源:origin: Vedenin/useful-java-links

public static void main(String[] args) {
    // init mapper
    Mapper mapper = new DozerBeanMapper();

    // convert
    Source source = new Source("Hello World!");
    Destination destObject = mapper.map(source, Destination.class);
    destObject.print(); // print Hello World!
  }
}

代码示例来源:origin: Netflix/metacat

/**
 * Converts from PartitionDto to PartitionInfo.
 *
 * @param partitionDto partition dto
 * @return connector partition info
 */
public PartitionInfo fromPartitionDto(final PartitionDto partitionDto) {
  return mapper.map(partitionDto, PartitionInfo.class);
}

代码示例来源:origin: Netflix/metacat

/**
 * Converts from TableDto to TableInfo.
 *
 * @param tableDto table dto
 * @return connector table info
 */
public TableInfo fromTableDto(final TableDto tableDto) {
  return mapper.map(tableDto, TableInfo.class);
}

代码示例来源:origin: Netflix/metacat

/**
 * Creates the partition list connector request.
 *
 * @param partitionsRequestDto request containing the save request information
 * @return connector request
 */
public PartitionsSaveRequest toPartitionsSaveRequest(final PartitionsSaveRequestDto partitionsRequestDto) {
  return mapper.map(partitionsRequestDto, PartitionsSaveRequest.class);
}

代码示例来源:origin: Netflix/metacat

/**
 * Creates the partition list connector request.
 *
 * @param partitionsSaveResponse response on saving partitions
 * @return response dto
 */
public PartitionsSaveResponseDto toPartitionsSaveResponseDto(final PartitionsSaveResponse partitionsSaveResponse) {
  return mapper.map(partitionsSaveResponse, PartitionsSaveResponseDto.class);
}

代码示例来源:origin: Netflix/metacat

/**
 * Creates the connector context.
 *
 * @param metacatRequestContext request context
 * @return connector context
 */
public ConnectorRequestContext toConnectorContext(final MetacatRequestContext metacatRequestContext) {
  return mapper.map(metacatRequestContext, ConnectorRequestContext.class);
}

代码示例来源:origin: net.sf.dozer/dozer

/**
 * {@inheritDoc}
 */
public void map(Object source, Object destination) throws MappingException {
 getMappingProcessor().map(source, destination);
}

代码示例来源:origin: org.appverse.web.framework.modules.backend.core.api/appverse-web-modules-backend-core-api

@Override
public void convert(final PresentationBean presentationBean,
          BusinessBean businessBean, String scope)
    throws Exception {
  ((Mapper) dozerBeanMapperFactoryBean.getObject()).map(presentationBean,
      businessBean, scope);
}

代码示例来源:origin: org.appverse.web.framework.modules.backend.core.api/appverse-web-modules-backend-core-api

@Override
public BusinessBean convert(PresentationBean presentationBean,
              String scope) throws Exception {
  return ((Mapper) dozerBeanMapperFactoryBean.getObject()).map(
      presentationBean, businessBeanClass, scope);
}

代码示例来源:origin: pl.edu.icm.synat/synat-business-services-impl

@Override
public PublicationDownload apply(PersistablePublicationDownload input) {
  final PublicationDownload download;
  input.getOrganisation().trim();
  if (input instanceof PersistableBookSectionDownload) {
    download = mapper.map(input, BookSectionDownload.class);
  } else {
    download = mapper.map(input, JournalDownload.class);
  }
  return download;
}

代码示例来源:origin: apache/oozie

private void mapLauncher(final Global source, final GLOBAL destination) {
  if (source.getLauncher() != null) {
    destination.setLauncher(checkAndGetMapper().map(source.getLauncher(), LAUNCHER.class));
  }
}

代码示例来源:origin: apache/oozie

private void mapConfiguration(final Global source, final GLOBAL destination) {
  if (source.getConfiguration() != null) {
    destination.setConfiguration(checkAndGetMapper().map(source.getConfiguration(), CONFIGURATION.class));
  }
}

代码示例来源:origin: apache/oozie

private ACTION createErrorHandlerAction(final Node handlerNode, final KILL kill) {
    final ExplicitNode explicitNode = new ExplicitNode(handlerNode.getName(), handlerNode);
    final ACTION handlerAction = mapper.map(explicitNode, ACTION.class);

    final ACTIONTRANSITION ok = ensureOk(handlerAction);
    ok.setTo(kill.getName());

    final ACTIONTRANSITION error = ensureError(handlerAction);
    error.setTo(kill.getName());

    return handlerAction;
  }
}

代码示例来源:origin: apache/oozie

@Override
public WORKFLOWAPP convertTo(final Graph graph, final WORKFLOWAPP workflowapp) {
  final GraphNodes graphNodes = new GraphNodes(graph.getName(),
      graph.getParameters(),
      graph.getGlobal(),
      graph.getCredentials(),
      graph.getStart(),
      graph.getEnd(),
      graph.getNodes());
  return checkAndGetMapper().map(graphNodes, WORKFLOWAPP.class);
}

相关文章

微信公众号

最新文章

更多

Mapper类方法