private void scanFields ( Class < ? > c ) { if ( ! c . isInterface ( ) ) { Field [ ] fields = c . getDeclaredFields ( ) ; for ( Field field : fields ) { String fieldName = field . getName ( ) ; if ( pairs . containsKey ( fieldName ) ) { if ( field . isAnnotationPresent ( UriTransient . class ) ) { pairs . remove ( fieldName ) ; } else if ( field . isAnnotationPresent ( VarName . class ) ) { String name = field . getAnnotation ( VarName . class ) . value ( ) ; pairs . put ( name , pairs . get ( fieldName ) ) ; pairs . remove ( fieldName ) ; } } } } /* * We still need to scan the fields of the super class if its * not Object to check for annotations. There might be a better * way to do this. */ if ( ! c . getSuperclass ( ) . equals ( Object . class ) ) { scanFields ( c . getSuperclass ( ) ) ; } }
Scans the fields on the class or super classes to look for field - level annotations .