Total Complexity | 4 |
Total Lines | 22 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | package com.hltech.vaunt.generator; |
||
11 | @RequiredArgsConstructor |
||
12 | public class VauntGenerator { |
||
13 | |||
14 | private final RepresentationExtractor extractor; |
||
15 | private final RepresentationWriter writer; |
||
16 | |||
17 | public void writeVauntFile(String packageRoot, String serviceName, String targetDirectory) { |
||
18 | try { |
||
19 | writer.writeServiceRepresentation(serviceRepresentation(packageRoot, serviceName), targetDirectory); |
||
20 | } catch (IOException ex) { |
||
21 | throw new RuntimeException("Error when trying to write service representation to file", ex); |
||
22 | } |
||
23 | } |
||
24 | |||
25 | private Service serviceRepresentation(String packageRoot, String serviceName) { |
||
26 | try { |
||
27 | return extractor.extractServiceRepresentation(packageRoot, serviceName); |
||
28 | } catch (JsonMappingException ex) { |
||
29 | throw new RuntimeException( |
||
30 | String.format( |
||
31 | "Error when trying to extract service representation: package=%s, service name=%s", |
||
32 | packageRoot, serviceName), ex); |
||
33 | } |
||
36 |