Bug 1459-3 #2 - Re-organize mdsal-binding2-generator-api
[mdsal.git] / binding2 / mdsal-binding2-generator-api / src / main / java / org / opendaylight / mdsal / binding / javav2 / model / api / CodeGenerator.java
1 /*
2  * Copyright (c) 2017 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
9 package org.opendaylight.mdsal.binding.javav2.model.api;
10
11 import com.google.common.annotations.Beta;
12 import org.opendaylight.yangtools.concepts.Identifier;
13
14 /**
15  *
16  * Transforms virtual data to the concrete code in programming language.
17  *
18  */
19 @Beta
20 public interface CodeGenerator {
21
22     /**
23      * Generates code for <code>type</code>.
24      *
25      * @param type
26      *            Input type to be processed
27      * @return generated JAVA code
28      */
29     String generate(Type type);
30
31     /**
32      * Checks if the concrete instance of <code>type</code> fit to concrete
33      * implementation of this interface.
34      *
35      * (e. g. method return true if in <code>EnumGenerator</code> (which
36      * implements this interface) has input parameter of type Enumeration (which
37      * is subtype of Type)
38      *
39      * @param type
40      *            Input type to be processed
41      * @return true if type is acceptable for processing, otherwise false
42      */
43     boolean isAcceptable(Type type);
44
45     /**
46      * Returns name of <code>type</code> parameter.
47      *
48      * @param type
49      *            Input type to be processed
50      * @return generated unit
51      */
52     Identifier getUnitName(Type type);
53
54 }