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 .