/* * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl; import java.util.Collections; import java.util.List; import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.Constructor; import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.Field; import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.Header; import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.MethodDefinition; import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.TypeDeclaration; public class GeneralClassTemplate extends AbstractFtlTemplate { private final List constructors; public GeneralClassTemplate(Header header, String packageName, String name, List extendedClasses, List implementedIfcs, List fields, List methods) { this(header, packageName, name, extendedClasses, implementedIfcs, fields, methods, false, false, Collections . emptyList()); } public GeneralClassTemplate(Header header, String packageName, String name, List extendedClasses, List implementedIfcs, List fields, List methods, boolean isAbstract, boolean isFinal, List constructors) { super(header, packageName, fields, methods, new TypeDeclaration( "class", name, checkCardinality(extendedClasses), implementedIfcs, isAbstract, isFinal)); this.constructors = constructors; } static List checkCardinality(List extendedClass) { if (extendedClass.size() > 1) throw new IllegalArgumentException( "Class cannot have more than one super " + "class"); return extendedClass; } public List getConstructors() { return constructors; } }