Enhancements for the aai-common library
[aai/aai-common.git] / aai-core / src / main / java / org / onap / aai / util / delta / PropertyDelta.java
1 /**
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2017-2019 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 package org.onap.aai.util.delta;
21
22 import com.google.gson.annotations.SerializedName;
23 import org.apache.commons.lang3.builder.ToStringBuilder;
24
25 public class PropertyDelta {
26
27     @SerializedName("action")
28     protected DeltaAction action;
29
30     @SerializedName("value")
31     protected Object value;
32
33     @SerializedName("old-value")
34     private Object oldValue;
35
36
37     public PropertyDelta(DeltaAction action, Object value) {
38         this.action = action;
39         this.value = value;
40     }
41
42     public PropertyDelta(DeltaAction action, Object value, Object oldValue) {
43         this(action, value);
44         this.oldValue = oldValue;
45     }
46
47     public DeltaAction getAction() {
48         return action;
49     }
50
51     public void setAction(DeltaAction action) {
52         this.action = action;
53     }
54
55     public Object getValue() {
56         return value;
57     }
58
59     public void setValue(Object value) {
60         this.value = value;
61     }
62
63     public Object getOldValue() {
64         return oldValue;
65     }
66
67     public void setOldValue(Object oldValue) {
68         this.oldValue = oldValue;
69     }
70
71     @Override
72     public String toString() {
73         return new ToStringBuilder(this)
74             .append("action", action)
75             .append("value", value)
76             .append("oldValue", oldValue)
77             .toString();
78     }
79 }