Update eclipse.persistence and eelf.core in aai-common
[aai/aai-common.git] / aai-core / src / main / java / org / onap / aai / util / KeyValueList.java
1 /**
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *    http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.aai.util;
22
23 import com.fasterxml.jackson.annotation.JsonAnyGetter;
24 import com.fasterxml.jackson.annotation.JsonAnySetter;
25 import com.fasterxml.jackson.annotation.JsonIgnore;
26 import com.fasterxml.jackson.annotation.JsonInclude;
27 import com.fasterxml.jackson.annotation.JsonProperty;
28 import com.fasterxml.jackson.annotation.JsonPropertyOrder;
29
30 import java.util.HashMap;
31 import java.util.Map;
32
33 import javax.annotation.Generated;
34
35 import org.apache.commons.lang.builder.EqualsBuilder;
36 import org.apache.commons.lang.builder.HashCodeBuilder;
37 import org.apache.commons.lang.builder.ToStringBuilder;
38
39 @JsonInclude(JsonInclude.Include.NON_NULL)
40 @Generated("org.jsonschema2pojo")
41 @JsonPropertyOrder({"key", "value"})
42 public class KeyValueList {
43
44     @JsonProperty("key")
45     private String key;
46     @JsonProperty("value")
47     private String value;
48     @JsonIgnore
49     private Map<String, Object> additionalProperties = new HashMap<String, Object>();
50
51     /**
52      * 
53      * @return
54      *         The key
55      */
56     @JsonProperty("key")
57     public String getKey() {
58         return key;
59     }
60
61     /**
62      * 
63      * @param key
64      *        The key
65      */
66     @JsonProperty("key")
67     public void setKey(String key) {
68         this.key = key;
69     }
70
71     public KeyValueList withKey(String key) {
72         this.key = key;
73         return this;
74     }
75
76     /**
77      * 
78      * @return
79      *         The value
80      */
81     @JsonProperty("value")
82     public String getValue() {
83         return value;
84     }
85
86     /**
87      * 
88      * @param value
89      *        The value
90      */
91     @JsonProperty("value")
92     public void setValue(String value) {
93         this.value = value;
94     }
95
96     public KeyValueList withValue(String value) {
97         this.value = value;
98         return this;
99     }
100
101     @Override
102     public String toString() {
103         return ToStringBuilder.reflectionToString(this);
104     }
105
106     @JsonAnyGetter
107     public Map<String, Object> getAdditionalProperties() {
108         return this.additionalProperties;
109     }
110
111     @JsonAnySetter
112     public void setAdditionalProperty(String name, Object value) {
113         this.additionalProperties.put(name, value);
114     }
115
116     public KeyValueList withAdditionalProperty(String name, Object value) {
117         this.additionalProperties.put(name, value);
118         return this;
119     }
120
121     @Override
122     public int hashCode() {
123         return new HashCodeBuilder().append(key).append(value).append(additionalProperties).toHashCode();
124     }
125
126     @Override
127     public boolean equals(Object other) {
128         if (other == this) {
129             return true;
130         }
131         if ((other instanceof KeyValueList) == false) {
132             return false;
133         }
134         KeyValueList rhs = ((KeyValueList) other);
135         return new EqualsBuilder().append(key, rhs.key).append(value, rhs.value)
136                 .append(additionalProperties, rhs.additionalProperties).isEquals();
137     }
138
139 }