public Class getPropertyType(BeanEventType eventType, EventAdapterService eventAdapterService) { Class result = null; for (Iterator<Property> it = properties.iterator(); it.hasNext(); ) { Property property = it.next(); result = property.getPropertyType(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 == Map.class) { return null; } if (result.isArray() || result.isPrimitive() || JavaClassHelper.isJavaBuiltinDataType(result)) { return null; } eventType = eventAdapterService .getBeanEventTypeFactory() .createBeanType(result.getName(), result, false, false, false); } } return result; }
void init2ndPass() { init2ndPassNamesWithDefaults(); for (int i = 0; i < properties.size(); i++) { Property property = properties.get(i); property.setOrdinal(i); property.init2ndPass(); if (property.isPrimaryKey()) { propertiesPk.add(property); } else { propertiesNonPk.add(property); } } if (propertiesPk.size() == 1) { pkProperty = propertiesPk.get(0); pkType = schema.mapToJavaTypeNullable(pkProperty.getPropertyType()); } else { pkType = "Void"; } propertiesColumns = new ArrayList<Property>(properties); for (ToOne toOne : toOneRelations) { toOne.init2ndPass(); Property[] fkProperties = toOne.getFkProperties(); for (Property fkProperty : fkProperties) { if (!propertiesColumns.contains(fkProperty)) { propertiesColumns.add(fkProperty); } } } for (ToMany toMany : toManyRelations) { toMany.init2ndPass(); // Source Properties may not be virtual, so we do not need the following code: // for (Property sourceProperty : toMany.getSourceProperties()) { // if (!propertiesColumns.contains(sourceProperty)) { // propertiesColumns.add(sourceProperty); // } // } } if (active == null) { active = schema.isUseActiveEntitiesByDefault(); } active |= !toOneRelations.isEmpty() || !toManyRelations.isEmpty(); if (hasKeepSections == null) { hasKeepSections = schema.isHasKeepSectionsByDefault(); } init2ndPassIndexNamesWithDefaults(); for (ContentProvider contentProvider : contentProviders) { contentProvider.init2ndPass(); } }
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()); }