use of com.vaadin.flow.templatemodel.ComplexModelType in project flow by vaadin.
the class BeanModelType method getListModelType.
private static ModelType getListModelType(Type propertyType, PropertyFilter propertyFilter, String propertyName, Class<?> declaringClass) {
assert ListModelType.isList(propertyType);
ParameterizedType pt = (ParameterizedType) propertyType;
Type itemType = pt.getActualTypeArguments()[0];
if (itemType instanceof ParameterizedType) {
return new ListModelType<>((ComplexModelType<?>) getModelType(itemType, propertyFilter, propertyName, declaringClass));
} else {
if (!(itemType instanceof Class<?>)) {
throw new InvalidTemplateModelException("Element type " + itemType.getTypeName() + " is not a valid Bean type. Used in class " + declaringClass.getSimpleName() + " with property named " + propertyName + " with list type " + propertyType.getTypeName());
}
Class<?> beansListItemType = (Class<?>) itemType;
return new ListModelType<>(new BeanModelType<>(beansListItemType, propertyFilter));
}
}
Aggregations