use of org.modelmapper.ModelMapper in project Internet-Software-Architectures by zivko11.
the class UserManager method Create.
public boolean Create(UserDTO dto) {
ModelMapper mapper = new ModelMapper();
User user;
try {
user = mapper.map(dto, User.class);
} catch (Exception exc) {
exc.printStackTrace();
return false;
}
if (token == null) {
return false;
}
Date expiration = new Date();
expiration.setTime(expiration.getTime() + (24 * 60 * 60 * 1000));
user.setToken(token);
user.setExpiration(expiration);
userRepository.save(user);
return true;
}
use of org.modelmapper.ModelMapper in project easy-tests by malinink.
the class UserEntity method map.
public void map(UserModelInterface userModel) {
final ModelMapper modelMapper = new ModelMapper();
modelMapper.map(userModel, this);
}
use of org.modelmapper.ModelMapper in project microservices by pwillhan.
the class ModelMapperAutoConfiguration method modelMapper.
@Bean
@ConditionalOnMissingBean
public ModelMapper modelMapper() {
ModelMapper modelMapper = new ModelMapper();
addMappings(modelMapper);
addConverters(modelMapper);
return modelMapper;
}
use of org.modelmapper.ModelMapper in project selenium_java by sergueik.
the class ExcelReportWriter method write.
@Override
public void write(ExceptionRecord record) {
NormalRecord normalRecord = record.getNormalRecord();
ModelMapper mapper = new ModelMapper();
ExcelReport excelReport = mapper.map(normalRecord, ExcelReport.class);
excelReport.setDetail(record.getStackTraceText());
fillReport(normalRecord, ReportStatus.EXCEPTION, excelReport);
utils.export(excelReport);
}
use of org.modelmapper.ModelMapper in project useful-java-links by Vedenin.
the class ModelMapperHelloWorld method main.
public static void main(String[] args) {
// init mapper
PropertyMap<Source, Destination> orderMap = new PropertyMap<Source, Destination>() {
protected void configure() {
map().setText(source.getMessage());
}
};
ModelMapper modelMapper = new ModelMapper();
modelMapper.addMappings(orderMap);
// convert
Source source = new Source("Hello World!");
Destination destObject = modelMapper.map(source, Destination.class);
// print Hello World!
destObject.print();
}
Aggregations