本文整理汇总了Java中org.modelmapper.TypeMap类的典型用法代码示例。如果您正苦于以下问题:Java TypeMap类的具体用法?Java TypeMap怎么用?Java TypeMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TypeMap类属于org.modelmapper包,在下文中一共展示了TypeMap类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: userMapping
import org.modelmapper.TypeMap; //导入依赖的package包/类
@Bean
public TypeMapConfigurer<User, UserDto> userMapping() {
return new TypeMapConfigurer<User, UserDto>() {
@Override
public void configure(TypeMap<User, UserDto> typeMap) {
typeMap.addMapping(User::getAge, UserDto::setAge);
typeMap.setPreConverter(context -> {
String[] name = context.getSource().getName().split(" ");
context.getDestination().setFirstName(name[0]);
context.getDestination().setLastName(name[1]);
return context.getDestination();
});
}
};
}
开发者ID:rozidan,项目名称:modelmapper-spring-boot-starter,代码行数:17,代码来源:TypeMapConfigurerTest.java
示例2: userMapping
import org.modelmapper.TypeMap; //导入依赖的package包/类
@Bean
public TypeMapConfigurer<User, UserDto> userMapping() {
return new TypeMapConfigurer<User, UserDto>() {
@Override
public String getTypeMapName() {
return "userMappingV1";
}
@Override
public void configure(TypeMap<User, UserDto> typeMap) {
typeMap.addMapping(User::getAge, UserDto::setAge);
typeMap.addMapping(User::getName, UserDto::setFirstName);
}
};
}
开发者ID:rozidan,项目名称:modelmapper-spring-boot-starter,代码行数:17,代码来源:TypeMapNameTest.java
示例3: userMapping
import org.modelmapper.TypeMap; //导入依赖的package包/类
@Bean
public TypeMapConfigurer<User, UserDto> userMapping() {
return new TypeMapConfigurer<User, UserDto>() {
@Override
public org.modelmapper.config.Configuration getConfiguration() {
return new InheritingConfiguration().setSkipNullEnabled(true);
}
@Override
public void configure(TypeMap<User, UserDto> typeMap) {
typeMap.addMapping(User::getAge, UserDto::setAge);
typeMap.addMapping(User::getName, UserDto::setFirstName);
typeMap.addMapping(User::getName, UserDto::setLastName);
}
};
}
开发者ID:rozidan,项目名称:modelmapper-spring-boot-starter,代码行数:18,代码来源:TypeMapConfigurationTest.java
示例4: configure
import org.modelmapper.TypeMap; //导入依赖的package包/类
@Override
public void configure(TypeMap<User, UserDto> typeMap) {
typeMap.addMapping(User::getAge, UserDto::setAge);
typeMap.addMapping(User::getName, UserDto::setFirstName);
typeMap.addMapping(User::getName, UserDto::setLastName);
typeMap.addMapping(User::getName, UserDto::setMiddleName);
}
开发者ID:rozidan,项目名称:modelmapper-spring-boot-starter,代码行数:8,代码来源:UserDtoMapping.java
示例5: userMapping
import org.modelmapper.TypeMap; //导入依赖的package包/类
@Bean
public TypeMapConfigurer<User, UserDto> userMapping() {
return new TypeMapConfigurer<User, UserDto>() {
@Override
public org.modelmapper.config.Configuration getConfiguration() {
return new InheritingConfiguration().setSkipNullEnabled(true);
}
@Override
public String getTypeMapName() {
return "testName";
}
@Override
public void configure(TypeMap<User, UserDto> typeMap) {
typeMap.addMapping(User::getAge, UserDto::setAge);
typeMap.addMapping(User::getName, UserDto::setFirstName);
typeMap.addMapping(User::getName, UserDto::setLastName);
}
};
}
开发者ID:rozidan,项目名称:modelmapper-spring-boot-starter,代码行数:23,代码来源:TypeMapConfigurationAndNameTest.java
示例6: userMapping
import org.modelmapper.TypeMap; //导入依赖的package包/类
@Bean
public TypeMapConfigurer<User, UserDto> userMapping() {
return new TypeMapConfigurer<User, UserDto>() {
@Override
public void configure(TypeMap<User, UserDto> typeMap) {
typeMap.addMapping(User::getAge, UserDto::setAge);
typeMap.addMapping(User::getName, UserDto::setFirstName);
typeMap.addMapping(User::getName, UserDto::setLastName);
}
};
}
开发者ID:rozidan,项目名称:modelmapper-spring-boot-starter,代码行数:13,代码来源:ConfigurationConfigurerTest.java
示例7: createTypeMap
import org.modelmapper.TypeMap; //导入依赖的package包/类
private static <S, D> TypeMap<S, D> createTypeMap(
ModelMapper mapper, Class<S> sourceType, Class<D> destinationType, Configuration config) {
return mapper
.createTypeMap(sourceType, destinationType, config)
// We setPropertyCondition because ModelMapper seems to ignore this in
// the config
.setPropertyCondition(config.getPropertyCondition());
}
开发者ID:bramp,项目名称:ffmpeg-cli-wrapper,代码行数:10,代码来源:Mapper.java
示例8: setTypeMapForUserRegisterDTO
import org.modelmapper.TypeMap; //导入依赖的package包/类
private void setTypeMapForUserRegisterDTO(ModelMapper mapper) {
TypeMap<UserRegisterDTO, User> typeMap = mapper.createTypeMap(UserRegisterDTO.class, User.class);
typeMap.addMappings(mapping -> mapping.using(bcryptConverter()).map(UserRegisterDTO::getPassword, User::setPassword));
}
开发者ID:RFTDevGroup,项目名称:RFTBackend,代码行数:5,代码来源:ModelMapperConfig.java
示例9: configure
import org.modelmapper.TypeMap; //导入依赖的package包/类
@Override
public void configure(TypeMap<Product, ProductDto> typeMap) {
typeMap.addMapping(Product::getDesc, ProductDto::setDescription);
}
开发者ID:rozidan,项目名称:project-template,代码行数:5,代码来源:ProductMapping.java
示例10: addMappings
import org.modelmapper.TypeMap; //导入依赖的package包/类
@Override
public <S, D> TypeMap<S, D> addMappings(final PropertyMap<S, D> propertyMap) {
return modelMapper.addMappings(propertyMap);
}
开发者ID:antoniomaria,项目名称:karaf4-eclipselink-jpa,代码行数:5,代码来源:ModelMapperContextImpl.java
示例11: configure
import org.modelmapper.TypeMap; //导入依赖的package包/类
public abstract void configure(TypeMap<S, D> typeMap);
开发者ID:rozidan,项目名称:modelmapper-spring-boot-starter,代码行数:2,代码来源:TypeMapConfigurer.java
示例12: addMappings
import org.modelmapper.TypeMap; //导入依赖的package包/类
<S, D> TypeMap<S, D> addMappings(final PropertyMap<S, D> propertyMap);
开发者ID:antoniomaria,项目名称:karaf4-eclipselink-jpa,代码行数:2,代码来源:ModelMapperContext.java
注:本文中的org.modelmapper.TypeMap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论