public Collection < AnnotatedMethod > getMethods ( ) { for ( Method method : type . getDeclaredMethods ( ) ) { // only consider methods which have been explicitly declared in the // interface if ( ! method . isSynthetic ( ) ) { Class < ? > returnType = method . getReturnType ( ) ; Type genericReturnType = method . getGenericReturnType ( ) ; Class < ? > [ ] parameterTypes = method . getParameterTypes ( ) ; Type [ ] genericParameterTypes = method . getGenericParameterTypes ( ) ; if ( PropertyMethod . GET . matches ( method ) ) { String name = PropertyMethod . GET . getName ( method ) ; getters . put ( name , method ) ; addType ( type , name , returnType , genericReturnType ) ; } else if ( PropertyMethod . IS . matches ( method ) ) { String name = PropertyMethod . IS . getName ( method ) ; getters . put ( name , method ) ; addType ( type , name , returnType , genericReturnType ) ; } else if ( PropertyMethod . SET . matches ( method ) ) { String name = PropertyMethod . SET . getName ( method ) ; setters . put ( name , method ) ; addType ( type , name , parameterTypes [ 0 ] , genericParameterTypes [ 0 ] ) ; } else { methods . add ( method ) ; } } } List < AnnotatedMethod > typeMethods = new ArrayList <> ( ) ; Map < String , GetPropertyMethod > getPropertyMethods = new HashMap <> ( ) ; for ( Map . Entry < String , Method > methodEntry : getters . entrySet ( ) ) { String name = methodEntry . getKey ( ) ; Method getter = methodEntry . getValue ( ) ; Class < ? > propertyType = types . get ( name ) ; Type genericType = genericTypes . get ( name ) ; GetPropertyMethod getPropertyMethod = new GetPropertyMethod ( getter , name , propertyType , genericType ) ; typeMethods . add ( getPropertyMethod ) ; getPropertyMethods . put ( name , getPropertyMethod ) ; } for ( Map . Entry < String , Method > methodEntry : setters . entrySet ( ) ) { String name = methodEntry . getKey ( ) ; Method setter = methodEntry . getValue ( ) ; GetPropertyMethod getPropertyMethod = getPropertyMethods . get ( name ) ; Class < ? > propertyType = types . get ( name ) ; Type genericType = genericTypes . get ( name ) ; SetPropertyMethod setPropertyMethod = new SetPropertyMethod ( setter , getPropertyMethod , name , propertyType , genericType ) ; typeMethods . add ( setPropertyMethod ) ; } for ( Method method : methods ) { typeMethods . add ( new UserMethod ( method ) ) ; } return typeMethods ; }
Return the methods of the type .