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 org.opendaylight.yangtools.sal.binding.model.api.CodeGenerator;
\r
11 import org.opendaylight.yangtools.sal.binding.model.api.GeneratedTransferObject;
\r
12 import org.opendaylight.yangtools.sal.binding.model.api.GeneratedType;
\r
13 import org.opendaylight.yangtools.sal.binding.model.api.Type;
\r
15 public final class InterfaceGenerator implements CodeGenerator {
\r
18 public boolean isAcceptable(Type type) {
\r
19 return type instanceof GeneratedType && !(type instanceof GeneratedTransferObject);
\r
23 public String generate(Type type) {
\r
24 if (type instanceof GeneratedType && !(type instanceof GeneratedTransferObject)) {
\r
25 final GeneratedType genType = (GeneratedType) type;
\r
26 final InterfaceTemplate interfaceTemplate = new InterfaceTemplate(genType);
\r
27 return interfaceTemplate.generate();
\r
33 public String getUnitName(Type type) {
\r
34 return type.getName();
\r