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


Java Mapper.map方法代码示例

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


在下文中一共展示了Mapper.map方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: 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

示例4: 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

示例5: get

import org.dozer.Mapper; //导入方法依赖的package包/类
public T get(Id id) throws SharingRegistryException {
    E entity = execute(entityManager -> entityManager
            .find(dbEntityGenericClass, id));
    Mapper mapper = ObjectMapperSingleton.getInstance();
    if(entity == null)
        return null;
    return mapper.map(entity, thriftGenericClass);
}
 
开发者ID:apache,项目名称:airavata,代码行数:9,代码来源:AbstractRepository.java

示例6: updateUserProfile

import org.dozer.Mapper; //导入方法依赖的package包/类
public UserProfile updateUserProfile(UserProfile userProfile, Runnable postUpdateAction) {

        Mapper mapper = ObjectMapperSingleton.getInstance();
        UserProfileEntity entity = mapper.map(userProfile, UserProfileEntity.class);
        UserProfileEntity persistedCopy = JPAUtils.execute(entityManager -> {
            UserProfileEntity result = entityManager.merge(entity);
            postUpdateAction.run();
            return result;
        });
        return mapper.map(persistedCopy, UserProfile.class);
    }
 
开发者ID:apache,项目名称:airavata,代码行数:12,代码来源:UserProfileRepository.java

示例7: mapPartRevisionToPartDTO

import org.dozer.Mapper; //导入方法依赖的package包/类
public static PartRevisionDTO mapPartRevisionToPartDTO(PartRevision partRevision) {

        Mapper mapper = DozerBeanMapperSingletonWrapper.getInstance();

        PartRevisionDTO partRevisionDTO = mapper.map(partRevision, PartRevisionDTO.class);

        partRevisionDTO.setNumber(partRevision.getPartNumber());
        partRevisionDTO.setPartKey(partRevision.getPartNumber() + "-" + partRevision.getVersion());
        partRevisionDTO.setName(partRevision.getPartMaster().getName());
        partRevisionDTO.setStandardPart(partRevision.getPartMaster().isStandardPart());
        partRevisionDTO.setType(partRevision.getPartMaster().getType());

        if (partRevision.isObsolete()) {
            partRevisionDTO.setObsoleteDate(partRevision.getObsoleteDate());
            UserDTO obsoleteUserDTO = mapper.map(partRevision.getObsoleteAuthor(), UserDTO.class);
            partRevisionDTO.setObsoleteAuthor(obsoleteUserDTO);
        }

        if (partRevision.getReleaseAuthor() != null) {
            partRevisionDTO.setReleaseDate(partRevision.getReleaseDate());
            UserDTO releaseUserDTO = mapper.map(partRevision.getReleaseAuthor(), UserDTO.class);
            partRevisionDTO.setReleaseAuthor(releaseUserDTO);
        }

        List<PartIterationDTO> partIterationDTOs = new ArrayList<>();
        for (PartIteration partIteration : partRevision.getPartIterations()) {
            partIterationDTOs.add(mapPartIterationToPartIterationDTO(partIteration));
        }
        partRevisionDTO.setPartIterations(partIterationDTOs);

        if (partRevision.isCheckedOut()) {
            partRevisionDTO.setCheckOutDate(partRevision.getCheckOutDate());
            UserDTO checkoutUserDTO = mapper.map(partRevision.getCheckOutUser(), UserDTO.class);
            partRevisionDTO.setCheckOutUser(checkoutUserDTO);
        }

        if (partRevision.hasWorkflow()) {
            partRevisionDTO.setLifeCycleState(partRevision.getWorkflow().getLifeCycleState());
            partRevisionDTO.setWorkflow(mapper.map(partRevision.getWorkflow(), WorkflowDTO.class));
        }

        ACL acl = partRevision.getACL();
        if (acl != null) {
            partRevisionDTO.setAcl(Tools.mapACLtoACLDTO(acl));
        } else {
            partRevisionDTO.setAcl(null);
        }


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

示例8: update

import org.dozer.Mapper; //导入方法依赖的package包/类
public  T update(T t) throws SharingRegistryException {
    Mapper mapper = ObjectMapperSingleton.getInstance();
    E entity = mapper.map(t, dbEntityGenericClass);
    E persistedCopy = execute(entityManager -> entityManager.merge(entity));
    return mapper.map(persistedCopy, thriftGenericClass);
}
 
开发者ID:apache,项目名称:airavata,代码行数:7,代码来源:AbstractRepository.java

示例9: update

import org.dozer.Mapper; //导入方法依赖的package包/类
public T update(T t) {
    Mapper mapper = ObjectMapperSingleton.getInstance();
    E entity = mapper.map(t, dbEntityGenericClass);
    E persistedCopy = JPAUtils.execute(entityManager -> entityManager.merge(entity));
    return mapper.map(persistedCopy, thriftGenericClass);
}
 
开发者ID:apache,项目名称:airavata,代码行数:7,代码来源:AbstractRepository.java

示例10: get

import org.dozer.Mapper; //导入方法依赖的package包/类
public T get(Id id) {
    E entity = JPAUtils.execute(entityManager -> entityManager
            .find(dbEntityGenericClass, id));
    Mapper mapper = ObjectMapperSingleton.getInstance();
    return mapper.map(entity, thriftGenericClass);
}
 
开发者ID:apache,项目名称:airavata,代码行数:7,代码来源:AbstractRepository.java


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