public static Set < Field > getAllStaticFields ( Class < ? > type ) { final Set < Field > fields = new LinkedHashSet < Field > ( ) ; final Field [ ] declaredFields = type . getDeclaredFields ( ) ; for ( Field field : declaredFields ) { if ( Modifier . isStatic ( field . getModifiers ( ) ) ) { field . setAccessible ( true ) ; fields . add ( field ) ; } } return fields ; }
Get all static fields for a particular type .