common_helper/src/main/java/com/xiongyingqi/jackson/impl/JavassistFilterPropertyHandler.java
public Map<Class<?>, Class<?>> getProxyMixInAnnotation(Method method) {
//        if (isResponseBodyAnnotation && !method.isAnnotationPresent(ResponseBody.class)) {
//            return null;
//        }
        Map<Class<?>, Class<?>> map = proxyMethodMap.get(method);// 从缓存中查找是否存在

        if (map != null && map.entrySet().size() > 0) {// 如果已经读取该方法的注解信息，则从缓存中读取
            return map;
        } else {
            map = new HashMap<Class<?>, Class<?>>();
        }

        Class<?> clazzOfMethodIn = method.getDeclaringClass();// 方法所在的class

        Map<Class<?>, Collection<String>> pojoAndNamesMap = new HashMap<Class<?>, Collection<String>>();

        IgnoreProperties classIgnoreProperties = clazzOfMethodIn
                .getAnnotation(IgnoreProperties.class);
        IgnoreProperty classIgnoreProperty = clazzOfMethodIn.getAnnotation(IgnoreProperty.class);
        AllowProperty classAllowProperty = clazzOfMethodIn.getAnnotation(AllowProperty.class);

        IgnoreProperties ignoreProperties = method.getAnnotation(IgnoreProperties.class);
        IgnoreProperty ignoreProperty = method.getAnnotation(IgnoreProperty.class);
        AllowProperty allowProperty = method.getAnnotation(AllowProperty.class);

        if (allowProperty != null) {// 方法上的AllowProperty注解
            processAllowPropertyAnnotation(allowProperty, pojoAndNamesMap);
        }
        if (classAllowProperty != null) {
            processAllowPropertyAnnotation(classAllowProperty, pojoAndNamesMap);
        }

        if (classIgnoreProperties != null) {// 类上的IgnoreProperties注解
            processIgnorePropertiesAnnotation(classIgnoreProperties, pojoAndNamesMap);
        }
        if (classIgnoreProperty != null) {// 类上的IgnoreProperty注解
            processIgnorePropertyAnnotation(classIgnoreProperty, pojoAndNamesMap);
        }

        if (ignoreProperties != null) {// 方法上的IgnoreProperties注解
            processIgnorePropertiesAnnotation(ignoreProperties, pojoAndNamesMap);
        }
        if (ignoreProperty != null) {// 方法上的IgnoreProperties注解
            processIgnorePropertyAnnotation(ignoreProperty, pojoAndNamesMap);
        }

        Set<Entry<Class<?>, Collection<String>>> entries = pojoAndNamesMap.entrySet();
        for (Iterator<Entry<Class<?>, Collection<String>>> iterator = entries.iterator(); iterator
                .hasNext(); ) {
            Entry<Class<?>, Collection<String>> entry = (Entry<Class<?>, Collection<String>>) iterator
                    .next();
            Collection<String> nameCollection = entry.getValue();
            nameCollection = putGlobalIgnoreProperties(nameCollection);// 将全局过滤字段放入集合内
            String[] names = nameCollection.toArray(new String[]{});

            // EntityHelper.print(entry.getKey());
            // for (int i = 0; i < names.length; i++) {
            // String name = names[i];
            // EntityHelper.print(name);
            // }
            Class<?> clazz = createMixInAnnotation(names);

            map.put(entry.getKey(), clazz);
        }

        proxyMethodMap.put(method, map);
        return map;
    }
public Map<Class<?>, Class<?>> getProxyMixInAnnotation(Method method) {
//        if (isResponseBodyAnnotation && !method.isAnnotationPresent(ResponseBody.class)) {
//            return null;
//        }
        Map<Class<?>, Class<?>> map = proxyMethodMap.get(method);// 从缓存中查找是否存在

        if (map != null && map.entrySet().size() > 0) {// 如果已经读取该方法的注解信息，则从缓存中读取
            return map;
        } else {
            map = new HashMap<Class<?>, Class<?>>();
        }

        Class<?> clazzOfMethodIn = method.getDeclaringClass();// 方法所在的class

        Map<Class<?>, Collection<String>> pojoAndNamesMap = new HashMap<Class<?>, Collection<String>>();

        IgnoreProperties classIgnoreProperties = clazzOfMethodIn
                .getAnnotation(IgnoreProperties.class);
        IgnoreProperty classIgnoreProperty = clazzOfMethodIn.getAnnotation(IgnoreProperty.class);
        AllowProperty classAllowProperty = clazzOfMethodIn.getAnnotation(AllowProperty.class);

        IgnoreProperties ignoreProperties = method.getAnnotation(IgnoreProperties.class);
        IgnoreProperty ignoreProperty = method.getAnnotation(IgnoreProperty.class);
        AllowProperty allowProperty = method.getAnnotation(AllowProperty.class);

        if (allowProperty != null) {// 方法上的AllowProperty注解
            processAllowPropertyAnnotation(allowProperty, pojoAndNamesMap);
        }
        if (classAllowProperty != null) {
            processAllowPropertyAnnotation(classAllowProperty, pojoAndNamesMap);
        }

        if (classIgnoreProperties != null) {// 类上的IgnoreProperties注解
            processIgnorePropertiesAnnotation(classIgnoreProperties, pojoAndNamesMap);
        }
        if (classIgnoreProperty != null) {// 类上的IgnoreProperty注解
            processIgnorePropertyAnnotation(classIgnoreProperty, pojoAndNamesMap);
        }

        if (ignoreProperties != null) {// 方法上的IgnoreProperties注解
            processIgnorePropertiesAnnotation(ignoreProperties, pojoAndNamesMap);
        }
        if (ignoreProperty != null) {// 方法上的IgnoreProperties注解
            processIgnorePropertyAnnotation(ignoreProperty, pojoAndNamesMap);
        }

        Set<Entry<Class<?>, Collection<String>>> entries = pojoAndNamesMap.entrySet();
        for (Iterator<Entry<Class<?>, Collection<String>>> iterator = entries.iterator(); iterator
                .hasNext(); ) {
            Entry<Class<?>, Collection<String>> entry = (Entry<Class<?>, Collection<String>>) iterator
                    .next();
            Collection<String> nameCollection = entry.getValue();
            nameCollection = putGlobalIgnoreProperties(nameCollection);// 将全局过滤字段放入集合内
            String[] names = nameCollection.toArray(new String[]{});

            // EntityHelper.print(entry.getKey());
            // for (int i = 0; i < names.length; i++) {
            // String name = names[i];
            // EntityHelper.print(name);
            // }
            Class<?> clazz = createMixInAnnotation(names);

            map.put(entry.getKey(), clazz);
        }

        proxyMethodMap.put(method, map);
        return map;
    }
public Map < Class < ? > , Class < ? > > getProxyMixInAnnotation ( Method method ) { //        if (isResponseBodyAnnotation && !method.isAnnotationPresent(ResponseBody.class)) { //            return null; //        } Map < Class < ? > , Class < ? > > map = proxyMethodMap . get ( method ) ; // 从缓存中查找是否存在 if ( map != null && map . entrySet ( ) . size ( ) > 0 ) { // 如果已经读取该方法的注解信息，则从缓存中读取 return map ; } else { map = new HashMap < Class < ? > , Class < ? > > ( ) ; } Class < ? > clazzOfMethodIn = method . getDeclaringClass ( ) ; // 方法所在的class Map < Class < ? > , Collection < String > > pojoAndNamesMap = new HashMap < Class < ? > , Collection < String > > ( ) ; IgnoreProperties classIgnoreProperties = clazzOfMethodIn . getAnnotation ( IgnoreProperties . class ) ; IgnoreProperty classIgnoreProperty = clazzOfMethodIn . getAnnotation ( IgnoreProperty . class ) ; AllowProperty classAllowProperty = clazzOfMethodIn . getAnnotation ( AllowProperty . class ) ; IgnoreProperties ignoreProperties = method . getAnnotation ( IgnoreProperties . class ) ; IgnoreProperty ignoreProperty = method . getAnnotation ( IgnoreProperty . class ) ; AllowProperty allowProperty = method . getAnnotation ( AllowProperty . class ) ; if ( allowProperty != null ) { // 方法上的AllowProperty注解 processAllowPropertyAnnotation ( allowProperty , pojoAndNamesMap ) ; } if ( classAllowProperty != null ) { processAllowPropertyAnnotation ( classAllowProperty , pojoAndNamesMap ) ; } if ( classIgnoreProperties != null ) { // 类上的IgnoreProperties注解 processIgnorePropertiesAnnotation ( classIgnoreProperties , pojoAndNamesMap ) ; } if ( classIgnoreProperty != null ) { // 类上的IgnoreProperty注解 processIgnorePropertyAnnotation ( classIgnoreProperty , pojoAndNamesMap ) ; } if ( ignoreProperties != null ) { // 方法上的IgnoreProperties注解 processIgnorePropertiesAnnotation ( ignoreProperties , pojoAndNamesMap ) ; } if ( ignoreProperty != null ) { // 方法上的IgnoreProperties注解 processIgnorePropertyAnnotation ( ignoreProperty , pojoAndNamesMap ) ; } Set < Entry < Class < ? > , Collection < String > > > entries = pojoAndNamesMap . entrySet ( ) ; for ( Iterator < Entry < Class < ? > , Collection < String > > > iterator = entries . iterator ( ) ; iterator . hasNext ( ) ; ) { Entry < Class < ? > , Collection < String > > entry = ( Entry < Class < ? > , Collection < String > > ) iterator . next ( ) ; Collection < String > nameCollection = entry . getValue ( ) ; nameCollection = putGlobalIgnoreProperties ( nameCollection ) ; // 将全局过滤字段放入集合内 String [ ] names = nameCollection . toArray ( new String [ ] { } ) ; // EntityHelper.print(entry.getKey()); // for (int i = 0; i < names.length; i++) { // String name = names[i]; // EntityHelper.print(name); // } Class < ? > clazz = createMixInAnnotation ( names ) ; map . put ( entry . getKey ( ) , clazz ) ; } proxyMethodMap . put ( method , map ) ; return map ; }
根据方法获取过滤映射表 <br>
2013-10-25 下午2:47:34

@param method 注解了 @IgnoreProperties 或 @IgnoreProperty 的方法（所在的类）
@return Map pojo与其属性的映射表
根据方法获取过滤映射表 <br > 2013 - 10 - 25 下午2 : 47 : 34