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;
10 import java.util.Collections;
11 import java.util.List;
13 import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.Constructor;
14 import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.Field;
15 import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.Header;
16 import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.MethodDefinition;
17 import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.TypeDeclaration;
19 public class GeneralClassTemplate extends AbstractFtlTemplate {
21 private final List<Constructor> constructors;
23 public GeneralClassTemplate(Header header, String packageName, String name,
24 List<String> extendedClasses, List<String> implementedIfcs,
25 List<Field> fields, List<MethodDefinition> methods) {
26 this(header, packageName, name, extendedClasses, implementedIfcs,
27 fields, methods, false, false, Collections
28 .<Constructor> emptyList());
31 public GeneralClassTemplate(Header header, String packageName, String name,
32 List<String> extendedClasses, List<String> implementedIfcs,
33 List<Field> fields, List<MethodDefinition> methods,
34 boolean isAbstract, boolean isFinal, List<Constructor> constructors) {
35 super(header, packageName, fields, methods, new TypeDeclaration(
36 "class", name, checkCardinality(extendedClasses),
37 implementedIfcs, isAbstract, isFinal));
38 this.constructors = constructors;
41 static List<String> checkCardinality(List<String> extendedClass) {
42 if (extendedClass.size() > 1)
43 throw new IllegalArgumentException(
44 "Class cannot have more than one super " + "class");
48 public List<Constructor> getConstructors() {