本文整理了Java中org.modelmapper.ModelMapper.getConfiguration()
方法的一些代码示例,展示了ModelMapper.getConfiguration()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ModelMapper.getConfiguration()
方法的具体详情如下:
包路径:org.modelmapper.ModelMapper
类名称:ModelMapper
方法名:getConfiguration
[英]Returns the ModelMapper's configuration.
[中]返回ModelMapper的配置。
代码示例来源:origin: Raysmond/SpringBlog
private static ModelMapper getMapper() {
if (MAPPER == null) {
MAPPER = new ModelMapper();
MAPPER.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
}
return MAPPER;
}
代码示例来源:origin: bramp/ffmpeg-cli-wrapper
private static ModelMapper newModelMapper() {
final ModelMapper mapper = new ModelMapper();
Configuration config =
mapper
.getConfiguration()
.copy()
.setFieldMatchingEnabled(true)
.setPropertyCondition(notDefault)
.setSourceNameTokenizer(NameTokenizers.UNDERSCORE);
createTypeMap(mapper, MainEncodingOptions.class, FFmpegOutputBuilder.class, config);
createTypeMap(mapper, AudioWrapper.class, FFmpegOutputBuilder.class, config);
createTypeMap(mapper, VideoWrapper.class, FFmpegOutputBuilder.class, config);
return mapper;
}
代码示例来源:origin: stackoverflow.com
ModelMapper modelMapper = new ModelMapper();
modelMapper.getConfiguration()
.enableFieldMatching(true)
.setFieldAccessLevel(AccessLevel.PRIVATE);
代码示例来源:origin: Caratacus/Crown
@Override
public void setupModule(ModelMapper modelMapper) {
modelMapper.getConfiguration().getConverters().add(0, new FromTemporalConverter(config));
modelMapper.getConfiguration().getConverters().add(0, new ToTemporalConverter(config));
modelMapper.getConfiguration().getConverters().add(0, new TemporalToTemporalConverter());
}
}
代码示例来源:origin: Caratacus/Crown
@Override
public void setupModule(ModelMapper modelMapper) {
modelMapper.getConfiguration().getConverters().add(0, new FromOptionalConverter());
modelMapper.getConfiguration().getConverters().add(0, new ToOptionalConverter());
}
}
代码示例来源:origin: stackoverflow.com
ModelMapper mapper = new ModelMapper();
mapper.getConfiguration().setProvider(providerVo);
mapper.addConverter(converterDtoToVo);
代码示例来源:origin: getheimdall/heimdall
/**
* Converts a source to a type destination.
*
* @param source The source object
* @param typeDestination The type destination
* @return The object created
*/
public static <T, E> E mapper(T source, Class<E> typeDestination) {
ModelMapper modelMapper = new ModelMapper();
modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
return modelMapper.map(source, typeDestination);
}
代码示例来源:origin: jmnarloch/modelmapper-spring-boot-starter
@Override
public void configure(ModelMapper modelMapper) {
modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
}
};
代码示例来源:origin: getheimdall/heimdall
/**
* Converts a source to a type destination.
*
* @param source The source object
* @param destination The destination object
* @return The object created
*/
public static <T, E> E mapper(T source, E destination) {
ModelMapper modelMapper = new ModelMapper();
modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
modelMapper.map(source, destination);
return destination;
}
代码示例来源:origin: getheimdall/heimdall
/**
* Converts a source to a type destination.
*
* @param source The souce object
* @param typeDestination The type destination
* @return The object created
*/
public static <E, T> List<E> mapper(List<T> source, Type destinationType) {
List<E> model = null;
if (source != null && destinationType != null) {
ModelMapper modelMapper = new ModelMapper();
modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
model = modelMapper.map(source, destinationType);
}
return model;
}
}
代码示例来源:origin: getheimdall/heimdall
/**
* Converts a source to a type destination.
*
* @param source The souce object
* @param typeDestination The type destination
* @param mapping The properties for the mapping process
* @return The object created
*/
public static <T, E> E mapperWithMapping(T source, Class<E> typeDestination, PropertyMap<T, E> mapping) {
ModelMapper modelMapper = new ModelMapper();
modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
modelMapper.addMappings(mapping);
return modelMapper.map(source, typeDestination);
}
代码示例来源:origin: getheimdall/heimdall
/**
* Converts a source to a type destination.
*
* @param source The souce object
* @param destination The destination object
* @param mapping The properties for the mapping process
* @return The object created
*/
public static <T, E> E mapperWithMapping(T source, E destination, PropertyMap<T, E> mapping) {
ModelMapper modelMapper = new ModelMapper();
modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
modelMapper.addMappings(mapping);
modelMapper.map(source, destination);
return destination;
}
代码示例来源:origin: ConsenSys/eventeum
public Web3jTransactionReceipt(
org.web3j.protocol.core.methods.response.TransactionReceipt web3TransactionReceipt) {
logs = convertLogs(web3TransactionReceipt.getLogs());
try {
final ModelMapper modelMapper = ModelMapperFactory.getInstance().createModelMapper();
//Skip logs
modelMapper.getConfiguration().setPropertyCondition(ctx ->
!ctx.getMapping().getLastDestinationProperty().getName().equals("logs"));
modelMapper.map(web3TransactionReceipt, this);
} catch (RuntimeException re) {
re.printStackTrace();
throw re;
}
}
代码示例来源:origin: org.seedstack.addons.modelmapper/modelmapper
@Override
public ModelMapper get() {
ModelMapper modelMapper = new ModelMapper();
org.modelmapper.config.Configuration configuration = modelMapper.getConfiguration();
configuration.setFieldMatchingEnabled(modelMapperConfig.isFieldMatching());
configuration.setFieldAccessLevel(modelMapperConfig.getFieldAccessLevel());
configuration.setMethodAccessLevel(modelMapperConfig.getMethodAccessLevel());
configuration.setAmbiguityIgnored(modelMapperConfig.isAmbiguityIgnored());
configuration.setFullTypeMatchingRequired(modelMapperConfig.isFullTypeMatchingRequired());
configuration.setImplicitMappingEnabled(modelMapperConfig.isImplicitMatching());
configuration.setSourceNameTokenizer(modelMapperConfig.source().getNameTokenizer());
configuration.setSourceNameTransformer(modelMapperConfig.source().getNameTransformer());
configuration.setSourceNamingConvention(modelMapperConfig.source().getNamingConvention());
configuration.setDestinationNameTokenizer(modelMapperConfig.destination().getNameTokenizer());
configuration.setDestinationNameTransformer(modelMapperConfig.destination().getNameTransformer());
configuration.setDestinationNamingConvention(modelMapperConfig.destination().getNamingConvention());
if (modelMapperConfig.isIgnoreNulls()) {
configuration.setPropertyCondition(Conditions.isNotNull());
}
return modelMapper;
}
}
内容来源于网络,如有侵权,请联系作者删除!