328c6fcb87e60f009308d95cfd656e5ec9fa8f06
[dcaegen2/analytics/tca.git] / dcae-analytics-model / src / main / java / org / openecomp / dcae / apod / analytics / model / util / json / mixin / BaseDynamicPropertiesProviderMixin.java
1 /*\r
2  * ===============================LICENSE_START======================================\r
3  *  dcae-analytics\r
4  * ================================================================================\r
5  *    Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
6  * ================================================================================\r
7  *  Licensed under the Apache License, Version 2.0 (the "License");\r
8  *  you may not use this file except in compliance with the License.\r
9  *   You may obtain a copy of the License at\r
10  *\r
11  *          http://www.apache.org/licenses/LICENSE-2.0\r
12  *\r
13  *  Unless required by applicable law or agreed to in writing, software\r
14  *  distributed under the License is distributed on an "AS IS" BASIS,\r
15  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  *  See the License for the specific language governing permissions and\r
17  *  limitations under the License.\r
18  *  ============================LICENSE_END===========================================\r
19  */\r
20 \r
21 package org.openecomp.dcae.apod.analytics.model.util.json.mixin;\r
22 \r
23 import com.fasterxml.jackson.annotation.JsonAnyGetter;\r
24 import com.fasterxml.jackson.annotation.JsonAnySetter;\r
25 import com.fasterxml.jackson.annotation.JsonIgnore;\r
26 import org.openecomp.dcae.apod.analytics.model.BaseDynamicPropertiesProvider;\r
27 \r
28 import java.util.Map;\r
29 \r
30 /**\r
31  * Json Mixin for {@link BaseDynamicPropertiesProvider}\r
32  *\r
33  * @author Rajiv Singla . Creation Date: 11/5/2016.\r
34  */\r
35 public abstract class BaseDynamicPropertiesProviderMixin implements JsonMixin {\r
36 \r
37     /**\r
38      * Provides hint to Jackson Json Object mapper to bind any put all dynamic properties in a map\r
39      *\r
40      * @param propertyName dynamic property name\r
41      * @param propertyValue dynamic property value\r
42      */\r
43     @JsonAnySetter\r
44     public abstract void addDynamicProperties(String propertyName, Object propertyValue);\r
45 \r
46     /**\r
47      * Provides hint to serialize dynamic properties as map\r
48      *\r
49      * @return dynamic properties map\r
50      */\r
51     @JsonAnyGetter\r
52     public abstract Map<String, Object> getDynamicProperties();\r
53 \r
54     /**\r
55      * Ignores isDynamicPropertiesPresent for json serialization\r
56      *\r
57      * @return true if dynamic properties are present\r
58      */\r
59     @JsonIgnore\r
60     public abstract boolean isDynamicPropertiesPresent();\r
61 }\r