summaryrefslogtreecommitdiffstats
path: root/dcaedt_catalog/commons/src/main/java/org/onap/sdc/dcae/catalog/commons/Proxies.java
diff options
context:
space:
mode:
Diffstat (limited to 'dcaedt_catalog/commons/src/main/java/org/onap/sdc/dcae/catalog/commons/Proxies.java')
-rw-r--r--dcaedt_catalog/commons/src/main/java/org/onap/sdc/dcae/catalog/commons/Proxies.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/dcaedt_catalog/commons/src/main/java/org/onap/sdc/dcae/catalog/commons/Proxies.java b/dcaedt_catalog/commons/src/main/java/org/onap/sdc/dcae/catalog/commons/Proxies.java
new file mode 100644
index 0000000..8983599
--- /dev/null
+++ b/dcaedt_catalog/commons/src/main/java/org/onap/sdc/dcae/catalog/commons/Proxies.java
@@ -0,0 +1,37 @@
+package org.onap.sdc.dcae.catalog.commons;
+
+import java.util.Map;
+import java.lang.reflect.ParameterizedType;
+
+import org.json.JSONObject;
+
+import org.onap.sdc.dcae.catalog.commons.ProxyBuilder;
+
+
+public class Proxies {
+
+ private Proxies() {
+ }
+
+
+ private static ProxyBuilder builder = new ProxyBuilder();
+
+ public static <T> T build(Map theData, Class<T> theType) {
+ return builder.build(new JSONObject(theData), theType);
+ }
+
+ public static <T> T build(Map theData, Map theContextData, Class<T> theType) {
+ return builder.build(new JSONObject(theData), theContextData, theType);
+ }
+
+ public static <T> T build(JSONObject theData, Class<T> theType) {
+ return builder.build(theData, theType);
+ }
+
+ public static <T> Class<T> typeArgument(Class theType) {
+ return (Class<T>)
+ ((ParameterizedType)theType.getGenericSuperclass()).
+ getActualTypeArguments()[0];
+ }
+
+}