2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model;
10 import java.util.List;
11 import org.opendaylight.controller.config.yangjmxgenerator.plugin.java.TypeName;
13 public class TypeDeclaration {
14 private final String type, name;
15 private final List<String> extended, implemented;
16 private final boolean isAbstract, isFinal;
18 public TypeDeclaration(String type, String name, List<String> extended,
19 List<String> implemented, boolean isAbstract, boolean isFinal) {
23 this.extended = extended;
24 this.implemented = implemented;
25 this.isAbstract = isAbstract;
26 this.isFinal = isFinal;
29 public TypeDeclaration(String type, String name, List<String> extended,
30 List<String> implemented) {
31 this(type, name, extended, implemented, false, false);
34 public boolean isAbstract() {
38 public boolean isFinal() {
42 public String getType() {
46 public String getName() {
50 public List<String> getExtended() {
54 public List<String> getImplemented() {
58 public TypeName toTypeName() {
59 if ("interface".equals(type)) {
60 return TypeName.interfaceType;
61 } else if ("class".equals(type)) {
63 return TypeName.absClassType;
65 return TypeName.finalClassType;
67 return TypeName.classType;
69 } else if ("enum".equals(type)) {
70 return TypeName.enumType;
72 throw new IllegalStateException("Type not supported: " + type);
77 public String toString() {
78 return "TypeDeclaration{" + "type='" + type + '\'' + ", name='" + name