Remove explicit default super-constructor calls
[controller.git] / opendaylight / config / yang-jmx-generator-plugin / src / main / java / org / opendaylight / controller / config / yangjmxgenerator / plugin / ftl / model / TypeDeclaration.java
index ee0aa2ff5c22a7e054a931b7a36a6d0b89569c94..be917dfdda49bba506e955967b2ea22796e125e1 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model;
 
 import java.util.List;
+import org.opendaylight.controller.config.yangjmxgenerator.plugin.java.TypeName;
 
 public class TypeDeclaration {
     private final String type, name;
@@ -16,7 +17,6 @@ public class TypeDeclaration {
 
     public TypeDeclaration(String type, String name, List<String> extended,
             List<String> implemented, boolean isAbstract, boolean isFinal) {
-        super();
         this.type = type;
         this.name = name;
         this.extended = extended;
@@ -54,6 +54,24 @@ public class TypeDeclaration {
         return implemented;
     }
 
+    public TypeName toTypeName() {
+        if ("interface".equals(type)) {
+            return TypeName.interfaceType;
+        } else if ("class".equals(type)) {
+            if (isAbstract) {
+                return TypeName.absClassType;
+            } else if (isFinal) {
+                return TypeName.finalClassType;
+            } else {
+                return TypeName.classType;
+            }
+        } else if ("enum".equals(type)) {
+            return TypeName.enumType;
+        } else {
+            throw new IllegalStateException("Type not supported: " + type);
+        }
+    }
+
     @Override
     public String toString() {
         return "TypeDeclaration{" + "type='" + type + '\'' + ", name='" + name