Fixed some major sonar issues in yang-validation-tool
[yangtools.git] / code-generator / binding-model-api / src / main / java / org / opendaylight / yangtools / sal / binding / model / api / CodeGenerator.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.sal.binding.model.api;
9
10 /**
11  * Transformates virtual data to the concrete code in programming language.
12  * 
13  */
14 public interface CodeGenerator {
15
16     /**
17      * Generates code for <code>type</code>.
18      * 
19      * @param type
20      *            Input type to be processed
21      * @return generated JAVA code
22      */
23     String generate(Type type);
24
25     /**
26      * Checks if the concrete instance of <code>type</code> fit to concrete
27      * implementation of this interface.
28      * 
29      * (e. g. method return true if in <code>EnumGenerator</code> (which
30      * implements this interface) has input parameter of type Enumeration (which
31      * is subtype of Type)
32      * 
33      * @param type
34      *            Input type to be processed
35      * @return true if type is acceptable for processing.
36      */
37     boolean isAcceptable(Type type);
38
39     /**
40      * Returns name of <code>type</code> parameter.
41      * 
42      * @param type
43      *            Input type to be processed
44      * @return name of generated unit
45      */
46     String getUnitName(Type type);
47
48 }