static Field [ ] getAllFields ( Class < ? > type ) { List < Field > fields = new ArrayList < Field > ( ) ; for ( Class < ? > clazz = type ; clazz != null ; clazz = clazz . getSuperclass ( ) ) { if ( clazz == MPBase . class || clazz == Object . class ) { break ; } fields . addAll ( Arrays . asList ( clazz . getDeclaredFields ( ) ) ) ; } Field [ ] fieldsArray = new Field [ fields . size ( ) ] ; return fields . toArray ( fieldsArray ) ; }
Retrieves all fields from a class except the ones from MPBase abstract class and Object class