本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}