diff options
author | 2018-12-12 16:36:04 +0100 | |
---|---|---|
committer | 2018-12-14 10:41:14 +0100 | |
commit | 336d71e343dff06a4270bb1b724dc488498d10b2 (patch) | |
tree | 0215532a2048153ee9b02cf272d676250a442a87 /rest-services/common-dependency/src | |
parent | 2cf4d3c25895df964e3767ebd78ad75f1bb74619 (diff) |
Add abstraction level for other components
* vesrion in poms updated to 1.1.0-SNAPSHOT
Change-Id: Ieaa0a8ead1a9a74206fe4bdee85944d11b96c843
Issue-ID: DCAEGEN2-986
Signed-off-by: pwielebs <piotr.wielebski@nokia.com>
Diffstat (limited to 'rest-services/common-dependency/src')
-rw-r--r-- | rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/AaiModel.java (renamed from rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/ConsumerDmaapModel.java) | 20 | ||||
-rw-r--r-- | rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/ClientModel.java | 24 | ||||
-rw-r--r-- | rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/DmaapModel.java | 24 | ||||
-rw-r--r-- | rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/JsonBodyBuilder.java (renamed from rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/CommonFunctions.java) | 22 |
4 files changed, 55 insertions, 35 deletions
diff --git a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/ConsumerDmaapModel.java b/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/AaiModel.java index 1bf9ff62..781aabee 100644 --- a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/ConsumerDmaapModel.java +++ b/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/AaiModel.java @@ -20,24 +20,8 @@ package org.onap.dcaegen2.services.sdk.rest.services.model; -import com.google.gson.annotations.SerializedName; -import org.immutables.gson.Gson; -import org.immutables.value.Value; +@FunctionalInterface +public interface AaiModel extends ClientModel { -/** - * @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 5/8/18 - */ - -@Value.Immutable -@Gson.TypeAdapters(fieldNamingStrategy = true) -public interface ConsumerDmaapModel { - - @SerializedName(value = "correlationId", alternate = "correlationId") String getCorrelationId(); - - @SerializedName(value = "ipaddress-v4-oam", alternate = "ipaddress-v4-oam") - String getIpv4(); - - @SerializedName(value = "ipaddress-v6-oam", alternate = "ipaddress-v6-oam") - String getIpv6(); } diff --git a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/ClientModel.java b/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/ClientModel.java new file mode 100644 index 00000000..f94985be --- /dev/null +++ b/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/ClientModel.java @@ -0,0 +1,24 @@ +/* + * ============LICENSE_START======================================================= + * DCAEGEN2-SERVICES-SDK + * ================================================================================ + * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.dcaegen2.services.sdk.rest.services.model; + +public interface ClientModel { +} diff --git a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/DmaapModel.java b/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/DmaapModel.java new file mode 100644 index 00000000..6c5731d8 --- /dev/null +++ b/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/DmaapModel.java @@ -0,0 +1,24 @@ +/* + * ============LICENSE_START======================================================= + * DCAEGEN2-SERVICES-SDK + * ================================================================================ + * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.dcaegen2.services.sdk.rest.services.model; + +public interface DmaapModel extends ClientModel { +} diff --git a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/CommonFunctions.java b/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/JsonBodyBuilder.java index 55b12e0a..e33f914f 100644 --- a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/CommonFunctions.java +++ b/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/JsonBodyBuilder.java @@ -20,27 +20,15 @@ package org.onap.dcaegen2.services.sdk.rest.services.model; -import com.google.gson.GsonBuilder; -import com.google.gson.TypeAdapterFactory; - -import java.util.ServiceLoader; - - -public class CommonFunctions { - - private CommonFunctions() { - } +@FunctionalInterface +public interface JsonBodyBuilder<T extends ClientModel> { /** * Method for serialization object by GSON. * - * @param consumerDmaapModel - object which will be serialized + * @param t - object which will be serialized * @return string from serialization */ - public static String createJsonBody(ConsumerDmaapModel consumerDmaapModel) { - GsonBuilder gsonBuilder = new GsonBuilder(); - ServiceLoader.load(TypeAdapterFactory.class).forEach(gsonBuilder::registerTypeAdapterFactory); - return gsonBuilder.create().toJson(ImmutableConsumerDmaapModel.builder().ipv4(consumerDmaapModel.getIpv4()) - .ipv6(consumerDmaapModel.getIpv6()).correlationId(consumerDmaapModel.getCorrelationId()).build()); - } + + String createJsonBody(T t); }
\ No newline at end of file |