public GenericPropertyDesc getPropertyTypeGeneric( BeanEventType eventType, EventAdapterService eventAdapterService) { GenericPropertyDesc result = null; for (Iterator<Property> it = properties.iterator(); it.hasNext(); ) { Property property = it.next(); result = property.getPropertyTypeGeneric(eventType, eventAdapterService); if (result == null) { // property not found, return null return null; } if (it.hasNext()) { // Map cannot be used to further nest as the type cannot be determined if (result.getType() == Map.class) { return null; } if (result.getType().isArray()) { return null; } eventType = eventAdapterService .getBeanEventTypeFactory() .createBeanType(result.getType().getName(), result.getType(), false, false, false); } } return result; }
public EventPropertyGetter getGetter( BeanEventType eventType, EventAdapterService eventAdapterService) { List<EventPropertyGetter> getters = new LinkedList<EventPropertyGetter>(); Property lastProperty = null; for (Iterator<Property> it = properties.iterator(); it.hasNext(); ) { Property property = it.next(); lastProperty = property; EventPropertyGetter getter = property.getGetter(eventType, eventAdapterService); if (getter == null) { return null; } if (it.hasNext()) { Class clazz = property.getPropertyType(eventType, eventAdapterService); if (clazz == null) { // if the property is not valid, return null return null; } // Map cannot be used to further nest as the type cannot be determined if (clazz == Map.class) { return null; } if (clazz.isArray()) { return null; } eventType = eventAdapterService .getBeanEventTypeFactory() .createBeanType(clazz.getName(), clazz, false, false, false); } getters.add(getter); } GenericPropertyDesc finalPropertyType = lastProperty.getPropertyTypeGeneric(eventType, eventAdapterService); return new NestedPropertyGetter( getters, eventAdapterService, finalPropertyType.getType(), finalPropertyType.getGeneric()); }