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

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

本文整理了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

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

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

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

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

  1. /**
  2. * 简单的复制出新对象ArrayList
  3. */
  4. public static <S, D> List<D> mapList(Iterable<S> sourceList, Class<D> destinationClass) {
  5. List<D> destionationList = new ArrayList<D>();
  6. for (S source : sourceList) {
  7. if (source != null) {
  8. destionationList.add(mapper.map(source, destinationClass));
  9. }
  10. }
  11. return destionationList;
  12. }

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

  1. /**
  2. * 简单的复制出新对象ArrayList
  3. */
  4. public static <S, D> List<D> mapList(Iterable<S> sourceList, Class<D> destinationClass) {
  5. List<D> destinationList = new ArrayList<D>();
  6. for (S source : sourceList) {
  7. if (source != null) {
  8. destinationList.add(mapper.map(source, destinationClass));
  9. }
  10. }
  11. return destinationList;
  12. }

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

  1. /**
  2. * 简单复制出新对象数组
  3. */
  4. public static <S, D> D[] mapArray(final S[] sourceArray, final Class<D> destinationClass) {
  5. D[] destinationArray = ArrayUtil.newArray(destinationClass, sourceArray.length);
  6. int i = 0;
  7. for (S source : sourceArray) {
  8. if (source != null) {
  9. destinationArray[i] = mapper.map(sourceArray[i], destinationClass);
  10. i++;
  11. }
  12. }
  13. return destinationArray;
  14. }
  15. }

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

  1. /**
  2. * 简单复制出新对象数组
  3. */
  4. public static <S, D> D[] mapArray(final S[] sourceArray, final Class<D> destinationClass) {
  5. D[] destinationArray = ArrayUtil.newArray(destinationClass, sourceArray.length);
  6. int i = 0;
  7. for (S source : sourceArray) {
  8. if (source != null) {
  9. destinationArray[i] = mapper.map(sourceArray[i], destinationClass);
  10. i++;
  11. }
  12. }
  13. return destinationArray;
  14. }
  15. }

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

  1. public static void main(String[] args) {
  2. // init mapper
  3. Mapper mapper = new DozerBeanMapper();
  4. // convert
  5. Source source = new Source("Hello World!");
  6. Destination destObject = mapper.map(source, Destination.class);
  7. destObject.print(); // print Hello World!
  8. }
  9. }

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

  1. /**
  2. * Converts from PartitionDto to PartitionInfo.
  3. *
  4. * @param partitionDto partition dto
  5. * @return connector partition info
  6. */
  7. public PartitionInfo fromPartitionDto(final PartitionDto partitionDto) {
  8. return mapper.map(partitionDto, PartitionInfo.class);
  9. }

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

  1. /**
  2. * Converts from TableDto to TableInfo.
  3. *
  4. * @param tableDto table dto
  5. * @return connector table info
  6. */
  7. public TableInfo fromTableDto(final TableDto tableDto) {
  8. return mapper.map(tableDto, TableInfo.class);
  9. }

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

  1. /**
  2. * Creates the partition list connector request.
  3. *
  4. * @param partitionsRequestDto request containing the save request information
  5. * @return connector request
  6. */
  7. public PartitionsSaveRequest toPartitionsSaveRequest(final PartitionsSaveRequestDto partitionsRequestDto) {
  8. return mapper.map(partitionsRequestDto, PartitionsSaveRequest.class);
  9. }

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

  1. /**
  2. * Creates the partition list connector request.
  3. *
  4. * @param partitionsSaveResponse response on saving partitions
  5. * @return response dto
  6. */
  7. public PartitionsSaveResponseDto toPartitionsSaveResponseDto(final PartitionsSaveResponse partitionsSaveResponse) {
  8. return mapper.map(partitionsSaveResponse, PartitionsSaveResponseDto.class);
  9. }

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

  1. /**
  2. * Creates the connector context.
  3. *
  4. * @param metacatRequestContext request context
  5. * @return connector context
  6. */
  7. public ConnectorRequestContext toConnectorContext(final MetacatRequestContext metacatRequestContext) {
  8. return mapper.map(metacatRequestContext, ConnectorRequestContext.class);
  9. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. public void map(Object source, Object destination) throws MappingException {
  5. getMappingProcessor().map(source, destination);
  6. }

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

  1. @Override
  2. public void convert(final PresentationBean presentationBean,
  3. BusinessBean businessBean, String scope)
  4. throws Exception {
  5. ((Mapper) dozerBeanMapperFactoryBean.getObject()).map(presentationBean,
  6. businessBean, scope);
  7. }

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

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

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

  1. @Override
  2. public PublicationDownload apply(PersistablePublicationDownload input) {
  3. final PublicationDownload download;
  4. input.getOrganisation().trim();
  5. if (input instanceof PersistableBookSectionDownload) {
  6. download = mapper.map(input, BookSectionDownload.class);
  7. } else {
  8. download = mapper.map(input, JournalDownload.class);
  9. }
  10. return download;
  11. }

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

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

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

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

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

  1. private ACTION createErrorHandlerAction(final Node handlerNode, final KILL kill) {
  2. final ExplicitNode explicitNode = new ExplicitNode(handlerNode.getName(), handlerNode);
  3. final ACTION handlerAction = mapper.map(explicitNode, ACTION.class);
  4. final ACTIONTRANSITION ok = ensureOk(handlerAction);
  5. ok.setTo(kill.getName());
  6. final ACTIONTRANSITION error = ensureError(handlerAction);
  7. error.setTo(kill.getName());
  8. return handlerAction;
  9. }
  10. }

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

  1. @Override
  2. public WORKFLOWAPP convertTo(final Graph graph, final WORKFLOWAPP workflowapp) {
  3. final GraphNodes graphNodes = new GraphNodes(graph.getName(),
  4. graph.getParameters(),
  5. graph.getGlobal(),
  6. graph.getCredentials(),
  7. graph.getStart(),
  8. graph.getEnd(),
  9. graph.getNodes());
  10. return checkAndGetMapper().map(graphNodes, WORKFLOWAPP.class);
  11. }

相关文章

Mapper类方法