public List < ConstantField > getConstants ( Class < ? > aClass ) { List < ConstantField > constants = new ArrayList <> ( ) ; List < Field > fields = Arrays . asList ( aClass . getDeclaredFields ( ) ) ; for ( Field field : fields ) { if ( Modifier . isStatic ( field . getModifiers ( ) ) && ! Modifier . isFinal ( field . getModifiers ( ) ) ) { if ( ! Modifier . isPublic ( field . getModifiers ( ) ) ) if ( tryMakeAccessible ) field . setAccessible ( true ) ; else continue ; constants . add ( processField ( aClass , field ) ) ; } } Iterator < ConstantField > itr = constants . iterator ( ) ; while ( itr . hasNext ( ) ) { if ( itr . next ( ) == null ) itr . remove ( ) ; } return constants ; }
Gets all fields that are potential constants .