aboutsummaryrefslogtreecommitdiffstats
path: root/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/StatefulEntityTypeFactory.java
diff options
context:
space:
mode:
Diffstat (limited to 'jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/StatefulEntityTypeFactory.java')
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/StatefulEntityTypeFactory.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/StatefulEntityTypeFactory.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/StatefulEntityTypeFactory.java
new file mode 100644
index 0000000..554450a
--- /dev/null
+++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/StatefulEntityTypeFactory.java
@@ -0,0 +1,28 @@
+package org.openecomp.sdc.toscaparser.api;
+
+import org.openecomp.sdc.toscaparser.api.elements.GroupType;
+import org.openecomp.sdc.toscaparser.api.elements.NodeType;
+import org.openecomp.sdc.toscaparser.api.elements.StatefulEntityType;
+import org.openecomp.sdc.toscaparser.jython.elements.JyGroupType;
+import org.openecomp.sdc.toscaparser.jython.elements.JyNodeType;
+import org.openecomp.sdc.toscaparser.jython.elements.JyStatefulEntityType;
+
+public class StatefulEntityTypeFactory {
+
+ public StatefulEntityType create(JyStatefulEntityType jyStatefulEntityType) {
+ String jyClassName = jyStatefulEntityType.getJyClassName();
+ StatefulEntityType statefulEntityType;
+ switch (jyClassName) {
+ case "NodeType":
+ statefulEntityType = new NodeType((JyNodeType) jyStatefulEntityType);
+ break;
+ case "GroupType":
+ statefulEntityType = new GroupType((JyGroupType) jyStatefulEntityType);
+ break;
+ default:
+ throw new UnsupportedOperationException(jyClassName + " is not supported!");
+ }
+
+ return statefulEntityType;
+ }
+} \ No newline at end of file