public static Set<Field> getDeclaredFields(Class<?> clazz, FieldFilter filter) {
        Set<Field> fields = new HashSet<Field>();
        Field[] allFields = clazz.getDeclaredFields();
        for(Field field : allFields) {
            if(filter.passFilter(field)) {
                fields.add(field);
            }
        }
        return fields;
    }
public static Set < Field > getDeclaredFields ( Class < ? > clazz , FieldFilter filter ) { Set < Field > fields = new HashSet < Field > ( ) ; Field [ ] allFields = clazz . getDeclaredFields ( ) ; for ( Field field : allFields ) { if ( filter . passFilter ( field ) ) { fields . add ( field ) ; } } return fields ; }
Returns a set of all fields matching the supplied filter
declared in the clazz class.

@param clazz     The class to inspect.
@param filter    Filter to use.

@return All matching fields declared by the clazz class.