2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
8 package org.opendaylight.yangtools.sal.java.api.generator;
\r
10 import java.io.IOException;
\r
11 import java.io.StringWriter;
\r
12 import java.io.Writer;
\r
14 import org.opendaylight.yangtools.sal.java.api.generator.InterfaceTemplate;
\r
15 import org.opendaylight.yangtools.sal.binding.model.api.CodeGenerator;
\r
16 import org.opendaylight.yangtools.sal.binding.model.api.GeneratedTransferObject;
\r
17 import org.opendaylight.yangtools.sal.binding.model.api.GeneratedType;
\r
18 import org.opendaylight.yangtools.sal.binding.model.api.Type;
\r
20 public final class InterfaceGenerator extends AbstractCodeGenerator {
\r
23 public Writer generate(Type type) throws IOException {
\r
24 final Writer writer = new StringWriter();
\r
25 if (type instanceof GeneratedType && !(type instanceof GeneratedTransferObject)) {
\r
26 final GeneratedType genType = (GeneratedType) type;
\r
27 final InterfaceTemplate interfaceTemplate = new InterfaceTemplate(genType);
\r
28 writer.write(interfaceTemplate.generate().toString());
\r