private void inspectGetters ( Method method ) { String methodName = method . getName ( ) ; int prefixLength = 0 ; if ( methodName . startsWith ( GET_PREFIX ) ) { prefixLength = GET_PREFIX . length ( ) ; } if ( methodName . startsWith ( IS_PREIX ) ) { prefixLength = IS_PREIX . length ( ) ; } if ( prefixLength == 0 ) { return ; } String name = decapitalize ( methodName . substring ( prefixLength ) ) ; if ( ! isValidProperty ( name ) ) { return ; } // Check that the return type is not null or void Class propertyType = method . getReturnType ( ) ; if ( propertyType == null || propertyType == void . class ) { return ; } // isXXX return boolean if ( prefixLength == 2 ) { if ( ! ( propertyType == boolean . class ) ) { return ; } } // validate parameter types Class [ ] paramTypes = method . getParameterTypes ( ) ; if ( paramTypes . length > 1 || ( paramTypes . length == 1 && paramTypes [ 0 ] != int . class ) ) { return ; } if ( ! method . isAnnotationPresent ( UriTransient . class ) && ! "class" . equals ( name ) ) { Object value = getValue ( method ) ; if ( method . isAnnotationPresent ( VarName . class ) ) { name = method . getAnnotation ( VarName . class ) . value ( ) ; } if ( value != null ) { pairs . put ( name , value ) ; } } }
A lite version of the introspection logic performed by the BeanInfo introspector .