CcmNG: Fix

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@5664 8810af33-2d31-482b-a856-94f89814c4df
jensp 2018-08-08 17:18:28 +00:00
parent b7e4e9e0d2
commit e99ce7ec82
1 changed files with 33 additions and 20 deletions

View File

@ -296,7 +296,8 @@ public class Components {
final ComponentModel componentModel) {
final Class<? extends ComponentModel> clazz = Objects
.requireNonNull(componentModel.getClass());
.requireNonNull(componentModel)
.getClass();
final ComponentModelJsonConverter jsonConverter
= findJsonConverter(clazz)
@ -453,19 +454,31 @@ public class Components {
final JsonObject data,
final ComponentModel componentModel) {
final BeanInfo beanInfo;
try {
beanInfo = Introspector.getBeanInfo(componentModel.getClass());
} catch (IntrospectionException ex) {
throw new WebApplicationException(ex);
}
final Class<? extends ComponentModel> clazz = Objects
.requireNonNull(componentModel)
.getClass();
Arrays
.stream(beanInfo.getPropertyDescriptors())
.forEach(
propertyDesc -> setComponentPropertyFromJson(componentModel,
propertyDesc,
data));
final ComponentModelJsonConverter jsonConverter
= findJsonConverter(clazz)
.orElseThrow(() -> new WebApplicationException(String.format(
"No JSON converter available for component model \"%s\".",
clazz.getName())));
jsonConverter.fromJson(data, componentModel);
// final BeanInfo beanInfo;
// try {
// beanInfo = Introspector.getBeanInfo(componentModel.getClass());
// } catch (IntrospectionException ex) {
// throw new WebApplicationException(ex);
// }
//
// Arrays
// .stream(beanInfo.getPropertyDescriptors())
// .forEach(
// propertyDesc -> setComponentPropertyFromJson(componentModel,
// propertyDesc,
// data));
}
/**