Comments of source code.
[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 import java.io.IOException;
11
12 /**
13  * Transformates virtual data to the concrete code in programming language.
14  * 
15  */
16 public interface CodeGenerator {
17
18     /**
19      * Generates code for <code>type</code>.
20      * 
21      * @param type
22      *            Input type to be processed
23      * @return generated JAVA code
24      * @throws IOException
25      */
26     String generate(Type type);
27
28     /**
29      * Checks if the concrete instance of <code>type</code> fit to concrete
30      * implementation of this interface.
31      * 
32      * (e. g. method return true if in <code>EnumGenerator</code> (which
33      * implements this interface) has input parameter of type Enumeration (which
34      * is subtype of Type)
35      * 
36      * @param type
37      *            Input type to be processed
38      * @return true if type is acceptable for processing.
39      */
40     boolean isAcceptable(Type type);
41
42     /**
43      * Returns name of <code>type</code> parameter.
44      * 
45      * @param type
46      *            Input type to be processed
47      * @return name of generated unit
48      */
49     String getUnitName(Type type);
50
51 }