--- /dev/null
+/*\r
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+package org.opendaylight.controller.sal.java.api.generator;\r
+\r
+import static org.opendaylight.controller.sal.java.api.generator.Constants.*;\r
+\r
+import java.io.IOException;\r
+import java.io.StringWriter;\r
+import java.io.Writer;\r
+import java.util.List;\r
+\r
+import org.opendaylight.controller.sal.binding.model.api.CodeGenerator;\r
+import org.opendaylight.controller.sal.binding.model.api.Constant;\r
+import org.opendaylight.controller.sal.binding.model.api.Enumeration;\r
+import org.opendaylight.controller.sal.binding.model.api.GeneratedType;\r
+import org.opendaylight.controller.sal.binding.model.api.MethodSignature;\r
+\r
+public class InterfaceGenerator implements CodeGenerator {\r
+\r
+ public Writer generate(GeneratedType type) throws IOException {\r
+ Writer writer = new StringWriter();\r
+ final List<Constant> constants = type.getConstantDefinitions();\r
+ final List<MethodSignature> methods = type.getMethodDefinitions();\r
+ final List<Enumeration> enums = type.getEnumDefintions();\r
+\r
+ writer.write(GeneratorUtil.createIfcDeclarationWithPkgName(\r
+ type.getPackageName(), type.getName(), ""));\r
+ writer.write(NL);\r
+\r
+ if (constants != null) {\r
+ for (Constant c : constants) {\r
+ writer.write(GeneratorUtil.createConstant(c, TAB) + NL);\r
+ }\r
+ writer.write(NL);\r
+ }\r
+\r
+ if (methods != null) {\r
+ for (MethodSignature m : methods) {\r
+ writer.write(GeneratorUtil.createMethodDeclaration(m, TAB) + NL);\r
+ }\r
+ writer.write(NL);\r
+ }\r
+\r
+ if (enums != null) {\r
+ for (Enumeration e : enums) {\r
+ writer.write(GeneratorUtil.createEnum(e, TAB) + NL);\r
+ }\r
+ writer.write(NL);\r
+ }\r
+\r
+ writer.write(RCB);\r
+\r
+ return writer;\r
+ }\r
+\r
+}\r