| Total Complexity | 3 | 
| Total Lines | 22 | 
| Duplicated Lines | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | package com.hltech.pact.gen.domain.client.jaxrs; | ||
| 11 | public class JaxRsMethodRepresentationExtractor implements ClientMethodRepresentationExtractor { | ||
| 12 | |||
| 13 | private final Collection<AnnotatedMethodHandler> annotatedMethodHandlers; | ||
| 14 | |||
| 15 |     public JaxRsMethodRepresentationExtractor(Collection<AnnotatedMethodHandler> annotatedMethodHandlers) { | ||
| 16 | this.annotatedMethodHandlers = annotatedMethodHandlers; | ||
| 17 | } | ||
| 18 | |||
| 19 | //TODO add response extraction | ||
| 20 | @Override | ||
| 21 |     public ClientMethodRepresentation extractClientMethodRepresentation(Method clientMethod) { | ||
| 22 | return ClientMethodRepresentation.builder() | ||
| 23 | .requestRepresentation(extractRequestProperties(clientMethod)) | ||
| 24 | .responseRepresentationList(null) | ||
| 25 | .build(); | ||
| 26 | } | ||
| 27 | |||
| 28 |     private RequestRepresentation extractRequestProperties(Method clientMethod) { | ||
| 29 | return this.annotatedMethodHandlers.stream() | ||
| 30 | .filter(annotationHandler -> annotationHandler.isSupported(clientMethod)) | ||
| 31 |                 .findFirst().orElseThrow(() -> new IllegalArgumentException("Unknown HTTP method")) | ||
| 32 | .handleRequest(clientMethod); | ||
| 33 | } | ||
| 35 |