| Total Complexity | 1 |
| Total Lines | 14 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | package com.hltech.pact.gen.domain.pact; |
||
| 13 | public class EnumStringManufacturer extends StringTypeManufacturerImpl { |
||
| 14 | |||
| 15 | @Override |
||
| 16 | public String getType(DataProviderStrategy strategy, |
||
| 17 | AttributeMetadata attributeMetadata, |
||
| 18 | Map<String, Type> genericTypesArgumentsMap) { |
||
| 19 | |||
| 20 | Optional<Annotation> jsonPropertyAnnotation = attributeMetadata.getAttributeAnnotations().stream() |
||
| 21 | .filter(annotation -> annotation.annotationType().equals(JsonProperty.class)) |
||
| 22 | .findAny(); |
||
| 23 | |||
| 24 | return jsonPropertyAnnotation.filter(annotation -> !((JsonProperty) annotation).defaultValue().isEmpty()) |
||
| 25 | .map(annotation -> ((JsonProperty) annotation).defaultValue()) |
||
| 26 | .orElseGet(() -> super.getType(strategy, attributeMetadata, genericTypesArgumentsMap)); |
||
| 27 | } |
||
| 29 |