private static String [ ] fieldNames ( Class < ? > beanType ) { Field [ ] fields = Stream . of ( beanType . getDeclaredFields ( ) ) . filter ( f -> ! Modifier . isStatic ( f . getModifiers ( ) ) && f . getAnnotation ( PropertyDefinition . class ) != null ) . toArray ( Field [ ] :: new ) ; List < String > fieldNames = new ArrayList <> ( ) ; for ( int i = 0 ; i < fields . length ; i ++ ) { fieldNames . add ( fields [ i ] . getName ( ) ) ; } return fieldNames . toArray ( new String [ fieldNames . size ( ) ] ) ; }
determine the field names by reflection