/** * Retrieves mapping of {@link MethodSignature}-s to a {@link List} of accessible methods for a class. In case the * class is not public, retrieves methods with same signature as its public methods from public superclasses and * interfaces. Basically upcasts every method to the nearest accessible method. */ private static Map<MethodSignature, List<Method>> discoverAccessibleMethods(Class<?> clazz) { Map<MethodSignature, List<Method>> accessibles = new HashMap<MethodSignature, List<Method>>(); discoverAccessibleMethods(clazz, accessibles); return accessibles; }
discoverAccessibleMethods(interfaces[i], accessibles); discoverAccessibleMethods(superclass, accessibles);
/** * 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()); } }
/** * Retrieves mapping of {@link MethodSignature}-s to a {@link List} of accessible methods for a class. In case the * class is not public, retrieves methods with same signature as its public methods from public superclasses and * interfaces. Basically upcasts every method to the nearest accessible method. */ private static Map<MethodSignature, List<Method>> discoverAccessibleMethods(Class<?> clazz) { Map<MethodSignature, List<Method>> accessibles = new HashMap<MethodSignature, List<Method>>(); discoverAccessibleMethods(clazz, accessibles); return accessibles; }
/** * Retrieves mapping of {@link MethodSignature}-s to a {@link List} of accessible methods for a class. In case the * class is not public, retrieves methods with same signature as its public methods from public superclasses and * interfaces. Basically upcasts every method to the nearest accessible method. */ private static Map<MethodSignature, List<Method>> discoverAccessibleMethods(Class<?> clazz) { Map<MethodSignature, List<Method>> accessibles = new HashMap<MethodSignature, List<Method>>(); discoverAccessibleMethods(clazz, accessibles); return accessibles; }
discoverAccessibleMethods(interfaces[i], accessibles); discoverAccessibleMethods(superclass, accessibles);
discoverAccessibleMethods(interfaces[i], accessibles); discoverAccessibleMethods(superclass, accessibles);
/** * 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()); } }