Merge "Add initial sources"
[externalapi/nbi.git] / src / main / java / org / onap / nbi / commons / JsonRepresentation.java
1 package org.onap.nbi.commons;
2
3 import java.util.LinkedHashSet;
4 import java.util.Set;
5 import org.springframework.util.MultiValueMap;
6
7 public class JsonRepresentation {
8
9     private Set<String> attributes = new LinkedHashSet<>();
10
11     public JsonRepresentation() {}
12
13     public JsonRepresentation(MultiValueMap<String, String> queryParameters) {
14         this.attributes = QueryParserUtils.getFields(queryParameters);
15     }
16
17     public JsonRepresentation(Set<String> attributes) {
18         this.attributes.addAll(attributes);
19     }
20
21     public JsonRepresentation add(String attributePath) {
22         this.attributes.add(attributePath);
23         return this;
24     }
25
26     public JsonRepresentation add(JsonRepresentation jsonRepresentation) {
27         this.attributes.addAll(jsonRepresentation.getAttributes());
28         return this;
29     }
30
31     public Set<String> getAttributes() {
32         return attributes;
33     }
34
35 }