本文整理了Java中org.dozer.Mapper
类的一些代码示例,展示了Mapper
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mapper
类的具体详情如下:
包路径:org.dozer.Mapper
类名称:Mapper
[英]Public root interface for performing Dozer mappings from application code.
[中]用于从应用程序代码执行Dozer映射的公共根接口。
代码示例来源: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: Netflix/metacat
/**
* Converts from DatabaseInfo to DatabaseDto.
*
* @param databaseInfo connector table info
* @return database dto
*/
public DatabaseDto toDatabaseDto(final DatabaseInfo databaseInfo) {
return this.mapper.map(databaseInfo, DatabaseDto.class);
}
代码示例来源:origin: Netflix/metacat
/**
* Converts from TableDto to TableInfo.
*
* @param databaseDto database dto
* @return connector database info
*/
public DatabaseInfo fromDatabaseDto(final DatabaseDto databaseDto) {
return this.mapper.map(databaseDto, DatabaseInfo.class);
}
代码示例来源:origin: Netflix/metacat
/**
* Converts from PartitionInfo to PartitionDto.
*
* @param partitionInfo connector partition info
* @return partition dto
*/
public PartitionDto toPartitionDto(final PartitionInfo partitionInfo) {
return mapper.map(partitionInfo, PartitionDto.class);
}
代码示例来源:origin: com.netflix.metacat/metacat-common-server
/**
* 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: com.sdk4/sdk4-java-common
/**
* 简单的复制出新类型对象.
*
* @param source 源对象
* @param destinationClass 目的对象类型
* @param <S> 源对象类型
* @param <D> 目的对象类型
* @return 目的对象实例
*/
public static <S, D> D map(S source, Class<D> destinationClass) {
return mapper.map(source, destinationClass);
}
代码示例来源: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);
}
内容来源于网络,如有侵权,请联系作者删除!