Binding v2 DOM Codec - Javassist part
[mdsal.git] / binding2 / mdsal-binding2-generator-impl / src / main / java / org / opendaylight / mdsal / binding / javav2 / generator / impl / util / javassist / SourceCodeGenerator.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies s.r.o. 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.javav2.generator.impl.util.javassist;
9
10 import com.google.common.annotations.Beta;
11 import javassist.CtClass;
12 import javassist.CtField;
13 import javassist.CtMethod;
14
15 /**
16  * Interface for a class that that generates readable source code for a runtime generated class.
17  * The appendField/appendMethod methods append source code to a temporary output. When outputGeneratedSource
18  * is called, the entire class source code is generated and outputted.
19  */
20 @Beta
21 public interface SourceCodeGenerator {
22
23     /**
24      * Appends the given class field and value to the temporary output.
25      */
26     void appendField(CtField field, String value);
27
28     /**
29      * Appends the given method and source code body to the temporary output.
30      */
31     void appendMethod(CtMethod method, String code);
32
33     /**
34      * Generates the full source code for the given class and outputs it.
35      */
36     void outputGeneratedSource(CtClass ctClass);
37 }