当前位置: 首页>>代码示例>>Java>>正文


Java Mapper类代码示例

本文整理汇总了Java中org.dozer.Mapper的典型用法代码示例。如果您正苦于以下问题:Java Mapper类的具体用法?Java Mapper怎么用?Java Mapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Mapper类属于org.dozer包,在下文中一共展示了Mapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: covertTweet

import org.dozer.Mapper; //导入依赖的package包/类
private Tweet covertTweet(org.springframework.social.twitter.api.Tweet tweet) {

        Mapper mapper = new DozerBeanMapper();

        Tweet tweetNew = mapper.map(tweet, Tweet.class);
        tweetNew.setId(index++);

        Entities entities = mapper.map(tweet.getEntities(), Entities.class);
//        entities.setId(index++);
        tweetNew.setEntities(entities);

        TwitterProfile user = mapper.map(tweet.getUser(), TwitterProfile.class);
        user.setId(index++);
        tweetNew.setUser(user);

        return tweetNew;
    }
 
开发者ID:thinksky-sourcecode,项目名称:microservices-prototype,代码行数:18,代码来源:DataService.java

示例2: mapPathChoiceDTO

import org.dozer.Mapper; //导入依赖的package包/类
public static PathChoiceDTO mapPathChoiceDTO(PathChoice choice) {
    PathChoiceDTO pathChoiceDTO = new PathChoiceDTO();
    ArrayList<ResolvedPartLinkDTO> resolvedPath = new ArrayList<>();
    for (ResolvedPartLink resolvedPartLink : choice.getResolvedPath()) {
        ResolvedPartLinkDTO resolvedPartLinkDTO = new ResolvedPartLinkDTO();
        PartIteration resolvedIteration = resolvedPartLink.getPartIteration();
        resolvedPartLinkDTO.setPartIteration(new PartIterationDTO(resolvedIteration.getWorkspaceId(), resolvedIteration.getName(), resolvedIteration.getNumber(), resolvedIteration.getVersion(), resolvedIteration.getIteration()));
        PartLink partLink = resolvedPartLink.getPartLink();
        resolvedPartLinkDTO.setPartLink(new LightPartLinkDTO(partLink.getComponent().getNumber(), partLink.getComponent().getName(), partLink.getReferenceDescription(), partLink.getFullId()));
        resolvedPath.add(resolvedPartLinkDTO);
    }
    pathChoiceDTO.setResolvedPath(resolvedPath);
    Mapper mapper = DozerBeanMapperSingletonWrapper.getInstance();
    pathChoiceDTO.setPartUsageLink(mapper.map(choice.getPartUsageLink(), PartUsageLinkDTO.class));
    return pathChoiceDTO;
}
 
开发者ID:polarsys,项目名称:eplmp,代码行数:17,代码来源:Tools.java

示例3: select

import org.dozer.Mapper; //导入依赖的package包/类
public List<T> select(String query, int limit, int offset, Map<String, Object> queryParams) {
    List resultSet = (List) JPAUtils.execute(entityManager -> {
        Query jpaQuery = entityManager.createQuery(query);

        for (Map.Entry<String, Object> entry : queryParams.entrySet()) {

            jpaQuery.setParameter(entry.getKey(), entry.getValue());
        }

        return jpaQuery.setFirstResult(offset).setMaxResults(limit).getResultList();

    });
    Mapper mapper = ObjectMapperSingleton.getInstance();
    List<T> resultList = new ArrayList<>();
    resultSet.stream().forEach(rs -> resultList.add(mapper.map(rs, thriftGenericClass)));
    return resultList;
}
 
开发者ID:apache,项目名称:airavata,代码行数:18,代码来源:AbstractRepository.java

示例4: getDozer

import org.dozer.Mapper; //导入依赖的package包/类
/**
 * @return the {@link DozerBeanMapper}.
 */
@Bean
public Mapper getDozer() {

  List<String> beanMappings = new ArrayList<>();
  beanMappings.add(DOZER_MAPPING_XML);
  return new DozerBeanMapper(beanMappings);

}
 
开发者ID:oasp,项目名称:oasp-tutorial-sources,代码行数:12,代码来源:BeansDozerConfig.java

示例5: mapModificationNotificationToModificationNotificationDTO

import org.dozer.Mapper; //导入依赖的package包/类
public static ModificationNotificationDTO mapModificationNotificationToModificationNotificationDTO(ModificationNotification pNotification) {
    ModificationNotificationDTO dto = new ModificationNotificationDTO();
    Mapper mapper = DozerBeanMapperSingletonWrapper.getInstance();

    UserDTO userDTO = mapper.map(pNotification.getModifiedPart().getAuthor(), UserDTO.class);
    dto.setAuthor(userDTO);

    dto.setId(pNotification.getId());

    dto.setImpactedPartNumber(pNotification.getImpactedPart().getNumber());
    dto.setImpactedPartVersion(pNotification.getImpactedPart().getVersion());

    User ackAuthor = pNotification.getAcknowledgementAuthor();
    if (ackAuthor != null) {
        UserDTO ackDTO = mapper.map(ackAuthor, UserDTO.class);
        dto.setAckAuthor(ackDTO);
    }
    dto.setAcknowledged(pNotification.isAcknowledged());
    dto.setAckComment(pNotification.getAcknowledgementComment());
    dto.setAckDate(pNotification.getAcknowledgementDate());

    dto.setCheckInDate(pNotification.getModifiedPart().getCheckInDate());
    dto.setIterationNote(pNotification.getModifiedPart().getIterationNote());

    dto.setModifiedPartIteration(pNotification.getModifiedPart().getIteration());
    dto.setModifiedPartNumber(pNotification.getModifiedPart().getPartNumber());
    dto.setModifiedPartName(pNotification.getModifiedPart().getPartName());
    dto.setModifiedPartVersion(pNotification.getModifiedPart().getPartVersion());

    return dto;
}
 
开发者ID:polarsys,项目名称:eplmp,代码行数:32,代码来源:Tools.java

示例6: mapPartIterationToPartIterationDTO

import org.dozer.Mapper; //导入依赖的package包/类
public static PartIterationDTO mapPartIterationToPartIterationDTO(PartIteration partIteration) {
    Mapper mapper = DozerBeanMapperSingletonWrapper.getInstance();

    List<PartUsageLinkDTO> usageLinksDTO = new ArrayList<>();
    PartIterationDTO partIterationDTO = mapper.map(partIteration, PartIterationDTO.class);

    for (PartUsageLink partUsageLink : partIteration.getComponents()) {
        PartUsageLinkDTO partUsageLinkDTO = mapper.map(partUsageLink, PartUsageLinkDTO.class);
        List<CADInstanceDTO> cadInstancesDTO = new ArrayList<>();
        for (CADInstance cadInstance : partUsageLink.getCadInstances()) {
            CADInstanceDTO cadInstanceDTO = mapper.map(cadInstance, CADInstanceDTO.class);
            cadInstanceDTO.setMatrix(cadInstance.getRotationMatrix().getValues());
            cadInstancesDTO.add(cadInstanceDTO);
        }
        List<PartSubstituteLinkDTO> substituteLinkDTOs = new ArrayList<>();
        for (PartSubstituteLink partSubstituteLink : partUsageLink.getSubstitutes()) {
            PartSubstituteLinkDTO substituteLinkDTO = mapper.map(partSubstituteLink, PartSubstituteLinkDTO.class);
            substituteLinkDTOs.add(substituteLinkDTO);

        }
        partUsageLinkDTO.setCadInstances(cadInstancesDTO);
        partUsageLinkDTO.setSubstitutes(substituteLinkDTOs);
        usageLinksDTO.add(partUsageLinkDTO);
    }
    partIterationDTO.setComponents(usageLinksDTO);
    partIterationDTO.setNumber(partIteration.getPartRevision().getPartNumber());
    partIterationDTO.setVersion(partIteration.getPartRevision().getVersion());

    if (!partIteration.getGeometries().isEmpty()) {
        partIterationDTO.setGeometryFileURI("/api/files/" + partIteration.getSortedGeometries().get(0).getFullName());
    }

    return partIterationDTO;
}
 
开发者ID:polarsys,项目名称:eplmp,代码行数:35,代码来源:Tools.java

示例7: verifyCustomerMapping

import org.dozer.Mapper; //导入依赖的package包/类
@Test
public void verifyCustomerMapping() throws Exception {
    Mapper mapper = DozerTestArtifactsFactory.createMapper();
    Customer service = createServiceCustomer();
    org.apache.camel.converter.dozer.model.Customer model = mapper.map(service, org.apache.camel.converter.dozer.model.Customer.class);
    Customer roundTrip = mapper.map(model, Customer.class);
    assertEquals(service, roundTrip);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:9,代码来源:DozerTypeConverterTest.java

示例8: getAllStats

import org.dozer.Mapper; //导入依赖的package包/类
@RequestMapping(value = "/sensor/{sensorId}", method = RequestMethod.GET)
public List<StatDTO> getAllStats(Principal principal, @PathVariable String sensorId) {
    List<User> users = mUserRepository.findBySensorId(sensorId);

    // Check if this user can access this resource
    boolean allowed = false;

    for(User user : users) {
        if (principal.getName().equals(user.getName()))
            allowed = true;
    }

    if (!allowed)
        return null;


    // Get all stats
    List<PeriodStat> periodStats = mPeriodStatRepository.findBySensorId(sensorId);
    List<StatDTO> stats = new ArrayList<>();

    Mapper mapper = new DozerBeanMapper();

    for (PeriodStat periodStat : periodStats) {
        // If the period stat is complete (= all the days are present)
        if (periodStat.getDaysInPeriod().size() == StatUtils.getNumberOfDaysInPeriod(periodStat.getPeriod())) {
            stats.add(mapper.map(periodStat, StatDTO.class));
        }
    }

    return stats;
}
 
开发者ID:S23Y,项目名称:myconsumption-server,代码行数:32,代码来源:StatController.java

示例9: convert

import org.dozer.Mapper; //导入依赖的package包/类
@Override
public PresentationBean convert(IntegrationBean integrationBean,
                                String scope) throws Exception {
    return ((Mapper) dozerBeanMapperFactoryBean.getObject()).map(
            integrationBean, presentationBeanClass,
            scope);
}
 
开发者ID:Appverse,项目名称:appverse-server,代码行数:8,代码来源:AbstractDozerP2IBeanConverter.java

示例10: convertIntegrationList

import org.dozer.Mapper; //导入依赖的package包/类
@Override
public void convertIntegrationList(List<IntegrationBean> integrationBeans,
                                   List<PresentationBean> presentationBeans,
                                   String scope) throws Exception {
    if (integrationBeans.size() != presentationBeans.size()) {
        throw new ListDiffersSizeException();
    }
    for (int i = 0; i < integrationBeans.size(); i++) {
        ((Mapper) dozerBeanMapperFactoryBean.getObject()).map(
                integrationBeans.get(i), presentationBeans.get(i),
                scope);
    }
}
 
开发者ID:Appverse,项目名称:appverse-server,代码行数:14,代码来源:AbstractDozerP2IBeanConverter.java

示例11: convertPresentationList

import org.dozer.Mapper; //导入依赖的package包/类
@Override
public void convertPresentationList(
        List<PresentationBean> presentationBeans,
        List<IntegrationBean> integrationBeans,
        String scope) throws Exception {
    if (presentationBeans.size() != integrationBeans.size()) {
        throw new ListDiffersSizeException();
    }
    for (int i = 0; i < presentationBeans.size(); i++) {
        ((Mapper) dozerBeanMapperFactoryBean.getObject()).map(
                presentationBeans.get(i), integrationBeans.get(i),
                scope);
    }
}
 
开发者ID:Appverse,项目名称:appverse-server,代码行数:15,代码来源:AbstractDozerP2IBeanConverter.java

示例12: convert

import org.dozer.Mapper; //导入依赖的package包/类
@Override
public void convert(final BusinessBean businessBean,
                    PresentationBean presentationBean, String scope)
        throws Exception {
    ((Mapper) dozerBeanMapperFactoryBean.getObject()).map(businessBean,
            presentationBean, scope);
}
 
开发者ID:Appverse,项目名称:appverse-server,代码行数:8,代码来源:AbstractDozerP2BBeanConverter.java

示例13: convertBusinessList

import org.dozer.Mapper; //导入依赖的package包/类
@Override
public List<PresentationBean> convertBusinessList(
        List<BusinessBean> businessBeans, String scope)
        throws Exception {
    List<PresentationBean> presentationBeans = new ArrayList<PresentationBean>();
    for (BusinessBean businessBean : businessBeans) {
        PresentationBean presentationBean = ((Mapper) dozerBeanMapperFactoryBean
                .getObject()).map(businessBean, presentationBeanClass,
                scope);
        presentationBeans.add(presentationBean);
    }
    return presentationBeans;
}
 
开发者ID:Appverse,项目名称:appverse-server,代码行数:14,代码来源:AbstractDozerP2BBeanConverter.java

示例14: convertPresentationList

import org.dozer.Mapper; //导入依赖的package包/类
@Override
public List<BusinessBean> convertPresentationList(
        List<PresentationBean> presentationBeans,
        String scope) throws Exception {
    List<BusinessBean> businessBeans = new ArrayList<BusinessBean>();
    for (PresentationBean presentationBean : presentationBeans) {
        BusinessBean businessBean = ((Mapper) dozerBeanMapperFactoryBean
                .getObject()).map(presentationBean, businessBeanClass,
                scope);
        businessBeans.add(businessBean);
    }
    return businessBeans;
}
 
开发者ID:Appverse,项目名称:appverse-server,代码行数:14,代码来源:AbstractDozerP2BBeanConverter.java

示例15: convert

import org.dozer.Mapper; //导入依赖的package包/类
@Override
public void convert(final BusinessBean businessBean,
                    IntegrationBean integrationBean, String scope)
        throws Exception{
    ((Mapper) dozerBeanMapperFactoryBean.getObject()).map(businessBean,
                                                      integrationBean, scope);
}
 
开发者ID:Appverse,项目名称:appverse-server,代码行数:8,代码来源:AbstractDozerB2IBeanConverter.java


注:本文中的org.dozer.Mapper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。