re base code
[sdc.git] / catalog-be / src / test / java / org / openecomp / sdc / be / components / utils / InputsBuilder.java
1 package org.openecomp.sdc.be.components.utils;
2
3 import org.openecomp.sdc.be.datatypes.elements.Annotation;
4 import org.openecomp.sdc.be.model.InputDefinition;
5
6 import java.util.ArrayList;
7 import java.util.List;
8
9 public class InputsBuilder {
10
11     private InputDefinition input;
12
13     private InputsBuilder() {
14         this.input = new InputDefinition();
15     }
16
17     public static InputsBuilder create() {
18         return new InputsBuilder();
19     }
20
21     public InputsBuilder setName(String name) {
22         input.setName(name);
23         return this;
24     }
25
26     public InputsBuilder setPropertyId(String propertyId) {
27         input.setPropertyId(propertyId);
28         return this;
29     }
30
31     public InputsBuilder addAnnotation(Annotation annotation) {
32         List<Annotation> annotations = getAnnotations();
33         annotations.add(annotation);
34         return this;
35     }
36
37     private List<Annotation> getAnnotations() {
38         if (input.getAnnotations() == null) {
39             input.setAnnotations(new ArrayList<>());
40         }
41         return input.getAnnotations();
42     }
43
44     public InputDefinition build() {
45         return input;
46     }
47
48 }