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