private final Field [ ] getFields ( Class < ? extends Object > cls ) { Field [ ] ret = SEEN_CLASSES . get ( cls ) ; if ( ret != null ) { return ret ; } List < Field > retL = new ArrayList < Field > ( ) ; for ( Field f : cls . getDeclaredFields ( ) ) { if ( ! isSimpleType ( f ) ) { retL . add ( f ) ; f . setAccessible ( true ) ; } } //the 2nd case can occur if the incoming object is of type Object.class //--> See Test_084_SerailizationBugRefToPM. if ( cls . getSuperclass ( ) != Object . class && cls != Object . class ) { for ( Field f : getFields ( cls . getSuperclass ( ) ) ) { retL . add ( f ) ; } } ret = retL . toArray ( new Field [ retL . size ( ) ] ) ; SEEN_CLASSES . put ( cls , ret ) ; return ret ; }
Returns a List containing all of the Field objects for the given class . The fields include all public and private fields from the given class and its super classes .