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 org.opendaylight.controller.config.yangjmxgenerator.plugin.java.TypeName;
12 import java.util.List;
14 public class TypeDeclaration {
15 private final String type, name;
16 private final List<String> extended, implemented;
17 private final boolean isAbstract, isFinal;
19 public TypeDeclaration(String type, String name, List<String> extended,
20 List<String> implemented, boolean isAbstract, boolean isFinal) {
24 this.extended = extended;
25 this.implemented = implemented;
26 this.isAbstract = isAbstract;
27 this.isFinal = isFinal;
30 public TypeDeclaration(String type, String name, List<String> extended,
31 List<String> implemented) {
32 this(type, name, extended, implemented, false, false);
35 public boolean isAbstract() {
39 public boolean isFinal() {
43 public String getType() {
47 public String getName() {
51 public List<String> getExtended() {
55 public List<String> getImplemented() {
59 public TypeName toTypeName() {
60 if ("interface".equals(type)) {
61 return TypeName.interfaceType;
62 } else if ("class".equals(type)) {
64 return TypeName.absClassType;
66 return TypeName.finalClassType;
68 return TypeName.classType;
70 } else if ("enum".equals(type)) {
71 return TypeName.enumType;
73 throw new IllegalStateException("Type not supported: " + type);
78 public String toString() {
79 return "TypeDeclaration{" + "type='" + type + '\'' + ", name='" + name