public Object findFilterId()

in jackson2/src/java/org/apache/fulcrum/json/jackson/SimpleNameIntrospector.java [93:125]


    public Object findFilterId(Annotated ac) {
        Object id = super.findFilterId(ac);
        // Let's default to current behavior if annotation is found:
        // Object id = super.findFilterId(ac);
        // but use simple class name if not
        if (id == null) {
            String name = ac.getName();
            Class<?> targetClazz = ac.getRawType();
            if (!filteredClasses.isEmpty()
                    && filteredClasses.contains(targetClazz)
                    ) {
                logger.debug("filter applying to " +name);
                id = name;
            } else {
                // check if target class is a child from filter class -> apply filter 
                for (Class<?> filterClazz : filteredClasses) {
                    // the currently checked instance of type targetClazz is a child of the filter class filterClazz ->  filter child 
                    if (filterClazz.isAssignableFrom(targetClazz)) {
                        logger.debug("filter applying to parent " +filterClazz +" matching child class "+name );
                        id = name;
                        break;
                    }
                    // the currently checked instance of type targetClazz is a parent of the filter class filterClazz -> filter parent
                    if (targetClazz.isAssignableFrom(filterClazz)) {
                        logger.debug("filter applying to child " +filterClazz+" matching parent class "+name);
                        id = name;
                        break;
                    }
                }
            }
        }
        return id;
    }