private void addRelatedTypes(Class<?> type) { for (Method method : type.getMethods()) { if (method.getName().startsWith("get") && method.getName().length() > 3 && !method.getName().equals("getSClass")) { if (type.getAnnotation(XmlSeeAlso.class) != null) { XmlSeeAlso xmlSeeAlso = type.getAnnotation(XmlSeeAlso.class); for (Class<?> c : xmlSeeAlso.value()) { addType(c); } } if (type.getSuperclass() != null) { addType(type.getSuperclass()); } String fieldName = StringUtils.firstLowerCase(method.getName().substring(3)); try { if (type.getMethod("set" + StringUtils.firstUpperCase(fieldName), method.getReturnType()) != null) { addType(method.getReturnType()); } } catch (SecurityException e) { } catch (NoSuchMethodException e) { } if (getGenericType(method) != null) { addType(getGenericType(method)); } for (Class<?> pt : method.getParameterTypes()) { addType(pt); } } } }
try { if (instanceClass.getMethod("set" + StringUtils.firstUpperCase(fieldName), method.getReturnType()) != null) { Class<?> genericType = sServicesMap.getGenericType(method); boolean aggregate = List.class.isAssignableFrom(method.getReturnType()) || Set.class.isAssignableFrom(method.getReturnType()); SField sField = new SField(fieldName, sServicesMap.getSType(method.getReturnType().getName()), genericType == null ? null : sServicesMap.getSType(genericType.getName()), aggregate); try { if (instanceClass.getMethod("set" + StringUtils.firstUpperCase(fieldName), method.getReturnType()) != null) { Class<?> genericType = sServicesMap.getGenericType(method); boolean aggregate = List.class.isAssignableFrom(method.getReturnType()) || Set.class.isAssignableFrom(method.getReturnType()); SField sField = new SField(fieldName, sServicesMap.getSType(method.getReturnType().getName()), genericType == null ? null : sServicesMap.getSType(genericType.getName()), aggregate);