Bug 6859 #1 Binding generator v1 refactoring
[mdsal.git] / binding / mdsal-binding-generator-api / src / main / java / org / opendaylight / mdsal / 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.mdsal.binding.model.api;
9
10 /**
11  * Transformates virtual data to the concrete code in programming language.
12  */
13 public interface CodeGenerator {
14
15     /**
16      * Generates code for <code>type</code>.
17      *
18      * @param type
19      *            Input type to be processed
20      * @return generated JAVA code
21      */
22     String generate(Type type);
23
24     /**
25      * Checks if the concrete instance of <code>type</code> fit to concrete
26      * implementation of this interface.
27      *
28      * (e. g. method return true if in <code>EnumGenerator</code> (which
29      * implements this interface) has input parameter of type Enumeration (which
30      * is subtype of Type)
31      *
32      * @param type
33      *            Input type to be processed
34      * @return true if type is acceptable for processing.
35      */
36     boolean isAcceptable(Type type);
37
38     /**
39      * Returns name of <code>type</code> parameter.
40      *
41      * @param type
42      *            Input type to be processed
43      * @return name of generated unit
44      */
45     String getUnitName(Type type);
46
47 }