2 * Copyright (c) 2014 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.yangtools.sal.java.api.generator
10 import org.opendaylight.yangtools.sal.binding.model.api.GeneratedTransferObject
11 import org.opendaylight.yangtools.sal.binding.model.api.AccessModifier
14 * Template for generating JAVA class.
16 class UnionBuilderTemplate extends ClassTemplate {
19 * Creates instance of this class with concrete <code>genType</code>.
21 * @param genType generated transfer object which will be transformed to JAVA class source code
23 new(GeneratedTransferObject genType) {
27 def override body() '''
28 «type.comment.asJavadoc»
29 public class «type.name» {
36 def private generateMethods() '''
37 «FOR method : genTO.methodDefinitions»
38 «method.accessModifier.accessModifier»«IF method.static»static«ENDIF»«IF method.final» final«ENDIF» «method.
39 returnType.importedName» «method.name»(«method.parameters.generateParameters») {
40 throw new «UnsupportedOperationException.importedName»("Not yet implemented");
45 def private String getAccessModifier(AccessModifier modifier) {
47 case AccessModifier.PUBLIC: return "public "
48 case AccessModifier.PROTECTED: return "protected "
49 case AccessModifier.PRIVATE: return "private "