private static HashMap < String , Object > getRestInformation ( AnnotatedElement element ) throws MPException { if ( element . getAnnotations ( ) . length == 0 ) { throw new MPException ( "No rest method found" ) ; } HashMap < String , Object > hashAnnotation = new HashMap < String , Object > ( ) ; for ( Annotation annotation : element . getAnnotations ( ) ) { if ( annotation instanceof DELETE ) { DELETE delete = ( DELETE ) annotation ; if ( StringUtils . isEmpty ( delete . path ( ) ) ) { throw new MPException ( "Path not found for DELETE method" ) ; } hashAnnotation = fillHashAnnotations ( hashAnnotation , HttpMethod . DELETE , delete . path ( ) , null , delete . retries ( ) , delete . connectionTimeout ( ) , delete . socketTimeout ( ) ) ; } else if ( annotation instanceof GET ) { GET get = ( GET ) annotation ; if ( StringUtils . isEmpty ( get . path ( ) ) ) { throw new MPException ( "Path not found for GET method" ) ; } hashAnnotation = fillHashAnnotations ( hashAnnotation , HttpMethod . GET , get . path ( ) , null , get . retries ( ) , get . connectionTimeout ( ) , get . socketTimeout ( ) ) ; } else if ( annotation instanceof POST ) { POST post = ( POST ) annotation ; if ( StringUtils . isEmpty ( post . path ( ) ) ) { throw new MPException ( "Path not found for POST method" ) ; } hashAnnotation = fillHashAnnotations ( hashAnnotation , HttpMethod . POST , post . path ( ) , post . payloadType ( ) , post . retries ( ) , post . connectionTimeout ( ) , post . socketTimeout ( ) ) ; } else if ( annotation instanceof PUT ) { PUT put = ( PUT ) annotation ; if ( StringUtils . isEmpty ( put . path ( ) ) ) { throw new MPException ( "Path not found for PUT method" ) ; } hashAnnotation = fillHashAnnotations ( hashAnnotation , HttpMethod . PUT , put . path ( ) , put . payloadType ( ) , put . retries ( ) , put . connectionTimeout ( ) , put . socketTimeout ( ) ) ; } } return hashAnnotation ; }
Iterates the annotations of the entity method implementation it validates that only one method annotation is used in the entity implementation method .