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
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model;
9
10 import java.util.List;
11 import org.opendaylight.controller.config.yangjmxgenerator.plugin.java.TypeName;
12
13 public class TypeDeclaration {
14     private final String type, name;
15     private final List<String> extended, implemented;
16     private final boolean isAbstract, isFinal;
17
18     public TypeDeclaration(String type, String name, List<String> extended,
19             List<String> implemented, boolean isAbstract, boolean isFinal) {
20         this.type = type;
21         this.name = name;
22         this.extended = extended;
23         this.implemented = implemented;
24         this.isAbstract = isAbstract;
25         this.isFinal = isFinal;
26     }
27
28     public TypeDeclaration(String type, String name, List<String> extended,
29             List<String> implemented) {
30         this(type, name, extended, implemented, false, false);
31     }
32
33     public boolean isAbstract() {
34         return isAbstract;
35     }
36
37     public boolean isFinal() {
38         return isFinal;
39     }
40
41     public String getType() {
42         return type;
43     }
44
45     public String getName() {
46         return name;
47     }
48
49     public List<String> getExtended() {
50         return extended;
51     }
52
53     public List<String> getImplemented() {
54         return implemented;
55     }
56
57     public TypeName toTypeName() {
58         if ("interface".equals(type)) {
59             return TypeName.interfaceType;
60         } else if ("class".equals(type)) {
61             if (isAbstract) {
62                 return TypeName.absClassType;
63             } else if (isFinal) {
64                 return TypeName.finalClassType;
65             } else {
66                 return TypeName.classType;
67             }
68         } else if ("enum".equals(type)) {
69             return TypeName.enumType;
70         } else {
71             throw new IllegalStateException("Type not supported: " + type);
72         }
73     }
74
75     @Override
76     public String toString() {
77         return "TypeDeclaration{" + "type='" + type + '\'' + ", name='" + name
78                 + '\'' + '}';
79     }
80 }