/** * INTERNAL: * * @param property */ public void addDeclaredProperty(SDOProperty property, int index) { if (!getDeclaredPropertiesMap().containsKey(property.getName())) { int currentSize = getDeclaredProperties().size(); int allSize = getProperties().size(); int insertPlace = allSize - currentSize + index; // updateSubTypesProps if (isBaseType()) { for (int i = 0; i < getSubTypes().size(); i++) { SDOType nextSubType = (SDOType) getSubTypes().get(i); nextSubType.updateIndices(insertPlace, property); } } getDeclaredProperties().add(index, property); getProperties().add(insertPlace, property); property.setContainingType(this); getDeclaredPropertiesMap().put(property.getName(), property); if (property.hasAliasNames()) { for (int j = 0; j < property.getAliasNames().size(); j++) { getDeclaredPropertiesMap().put(property.getAliasNames().get(j), property); } } if ((property.getType() != null) && (property.getType().isChangeSummaryType())) { changeSummaryProperty = property; } } }
/** Verify that the class is a valid instance class. */ private boolean isValidInstanceClass(Class clazz) { if (isDataType) { return true; } if (!clazz.isInterface()) { return false; } for (Object object : this.getDeclaredProperties()) { SDOProperty sdoProperty = (SDOProperty) object; SDOType sdoPropertyType = sdoProperty.getType(); if (!sdoPropertyType.isChangeSummaryType()) { String javaType = SDOUtil.getJavaTypeForProperty(sdoProperty); try { // Verify get method String getMethodName = SDOUtil.getMethodName(sdoProperty.getName(), javaType); PrivilegedAccessHelper.getPublicMethod(clazz, getMethodName, EMPTY_CLASS_ARRAY, false); } catch (NoSuchMethodException e) { // if the method isn't found and the type is boolean try looking for a "get" method // instead of an "is" method if (sdoPropertyType == SDOConstants.SDO_BOOLEAN || sdoPropertyType == SDOConstants.SDO_BOOLEANOBJECT) { try { String booleanGetterMethodName = SDOUtil.getBooleanGetMethodName(sdoProperty.getName(), javaType); PrivilegedAccessHelper.getPublicMethod( clazz, booleanGetterMethodName, EMPTY_CLASS_ARRAY, false); } catch (NoSuchMethodException e2) { return false; } } else { return false; } } } } return true; }