/** * Creates a {@link Map} with the content as described for the return value of {@link #get(Class)}. */ private Map<Object, Object> createClassIntrospectionData(Class<?> clazz) { final Map<Object, Object> introspData = new HashMap<Object, Object>(); if (exposeFields) { addFieldsToClassIntrospectionData(introspData, clazz); } final Map<MethodSignature, List<Method>> accessibleMethods = discoverAccessibleMethods(clazz); addGenericGetToClassIntrospectionData(introspData, accessibleMethods); if (exposureLevel != BeansWrapper.EXPOSE_NOTHING) { try { addBeanInfoToClassIntrospectionData(introspData, clazz, accessibleMethods); } catch (IntrospectionException e) { LOG.warn("Couldn't properly perform introspection for class " + clazz, e); introspData.clear(); // FIXME NBC: Don't drop everything here. } } addConstructorsToClassIntrospectionData(introspData, clazz); if (introspData.size() > 1) { return introspData; } else if (introspData.size() == 0) { return Collections.emptyMap(); } else { // map.size() == 1 Entry<Object, Object> e = introspData.entrySet().iterator().next(); return Collections.singletonMap(e.getKey(), e.getValue()); } }
/** * Creates a {@link Map} with the content as described for the return value of {@link #get(Class)}. */ private Map<Object, Object> createClassIntrospectionData(Class<?> clazz) { final Map<Object, Object> introspData = new HashMap<Object, Object>(); if (exposeFields) { addFieldsToClassIntrospectionData(introspData, clazz); } final Map<MethodSignature, List<Method>> accessibleMethods = discoverAccessibleMethods(clazz); addGenericGetToClassIntrospectionData(introspData, accessibleMethods); if (exposureLevel != BeansWrapper.EXPOSE_NOTHING) { try { addBeanInfoToClassIntrospectionData(introspData, clazz, accessibleMethods); } catch (IntrospectionException e) { LOG.warn("Couldn't properly perform introspection for class " + clazz, e); introspData.clear(); // FIXME NBC: Don't drop everything here. } } addConstructorsToClassIntrospectionData(introspData, clazz); if (introspData.size() > 1) { return introspData; } else if (introspData.size() == 0) { return Collections.emptyMap(); } else { // map.size() == 1 Entry<Object, Object> e = introspData.entrySet().iterator().next(); return Collections.singletonMap(e.getKey(), e.getValue()); } }
/** * Creates a {@link Map} with the content as described for the return value of {@link #get(Class)}. */ private Map<Object, Object> createClassIntrospectionData(Class<?> clazz) { final Map<Object, Object> introspData = new HashMap<Object, Object>(); if (exposeFields) { addFieldsToClassIntrospectionData(introspData, clazz); } final Map<MethodSignature, List<Method>> accessibleMethods = discoverAccessibleMethods(clazz); addGenericGetToClassIntrospectionData(introspData, accessibleMethods); if (exposureLevel != BeansWrapper.EXPOSE_NOTHING) { try { addBeanInfoToClassIntrospectionData(introspData, clazz, accessibleMethods); } catch (IntrospectionException e) { LOG.warn("Couldn't properly perform introspection for class " + clazz, e); introspData.clear(); // FIXME NBC: Don't drop everything here. } } addConstructorsToClassIntrospectionData(introspData, clazz); if (introspData.size() > 1) { return introspData; } else if (introspData.size() == 0) { return Collections.emptyMap(); } else { // map.size() == 1 Entry<Object, Object> e = introspData.entrySet().iterator().next(); return Collections.singletonMap(e.getKey(), e.getValue()); } }