private Stream < String > reflectNames ( Object obj ) { Class < ? > type = obj . getClass ( ) ; if ( obj instanceof Class < ? > ) type = ( Class < ? > ) obj ; if ( obj instanceof ClassIdentifier ) type = ( ( ClassIdentifier ) obj ) . getTargetClass ( ) ; if ( Reflect . isGeneratedClass ( type ) ) return Stream . concat ( Stream . concat ( Stream . of ( StringUtil . classString ( type ) ) , Stream . concat ( Stream . of ( Reflect . getDeclaredVariables ( type ) ) . map ( StringUtil :: variableString ) . map ( " " :: concat ) , Stream . of ( Reflect . getDeclaredMethods ( type ) ) . map ( StringUtil :: methodString ) . map ( " " :: concat ) ) ) , Stream . of ( "}" ) ) ; else return Stream . concat ( Stream . concat ( Stream . of ( StringUtil . classString ( type ) ) , Stream . concat ( Stream . of ( type . getFields ( ) ) . map ( StringUtil :: variableString ) . map ( " " :: concat ) , Stream . of ( type . getMethods ( ) ) . map ( StringUtil :: methodString ) . map ( " " :: concat ) ) ) , Stream . of ( "}" ) ) ; }
Apply reflection to supplied value returning an iterable stream of strings . Allows iteration over true string representations of the class and member definitions . For generated classes the true or bsh definitions are retrieved and not the java reflection of the mock instances .