| Total Complexity | 2 | 
| Total Lines | 36 | 
| Duplicated Lines | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | package com.hltech.pact.gen.domain.client.model; | ||
| 12 | @Data | ||
| 13 | @Builder | ||
| 14 | public class ResponseRepresentation { | ||
| 15 | |||
| 16 | private final HttpStatus status; | ||
| 17 | private final List<Param> headers; | ||
| 18 | private final Body body; | ||
| 19 | private final String description; | ||
| 20 | private final boolean emptyBodyExpected; | ||
| 21 | |||
| 22 |     public static ResponseRepresentation getDefaultForMethod(Method method, String[] responseHeaders) { | ||
| 23 | return ResponseRepresentation.from( | ||
| 24 | HttpStatus.OK, | ||
| 25 | RawHeadersParser.parseAll(responseHeaders), | ||
| 26 | method, | ||
| 27 | "", | ||
| 28 | false); | ||
| 29 | } | ||
| 30 | |||
| 31 | public static ResponseRepresentation from(HttpStatus status, | ||
| 32 | List<Param> headers, | ||
| 33 | Method method, | ||
| 34 | String description, | ||
| 35 |                                                           boolean isEmptyBodyExpected) { | ||
| 36 | |||
| 37 | return ResponseRepresentation.builder() | ||
| 38 | .status(status) | ||
| 39 | .headers(headers) | ||
| 40 | .body(Body.builder() | ||
| 41 | .type(method.getReturnType()) | ||
| 42 | .genericArgumentTypes( | ||
| 43 | TypeExtractor.extractParameterTypesFromType(method.getGenericReturnType())) | ||
| 44 | .build()) | ||
| 45 | .description(description) | ||
| 46 | .emptyBodyExpected(isEmptyBodyExpected) | ||
| 47 | .build(); | ||
| 48 | } | ||
| 50 |