com.github.talberto.easybeans.gen.tools
Class DynamicJavaSourceCodeObject

java.lang.Object
  extended by javax.tools.SimpleJavaFileObject
      extended by com.github.talberto.easybeans.gen.tools.DynamicJavaSourceCodeObject
All Implemented Interfaces:
FileObject, JavaFileObject

public class DynamicJavaSourceCodeObject
extends SimpleJavaFileObject

Creates a dynamic source code file object This is an example of how we can prepare a dynamic java source code for compilation. This class reads the java code from a string and prepares a JavaFileObject


Nested Class Summary
 
Nested classes/interfaces inherited from interface javax.tools.JavaFileObject
JavaFileObject.Kind
 
Field Summary
 
Fields inherited from class javax.tools.SimpleJavaFileObject
kind, uri
 
Constructor Summary
DynamicJavaSourceCodeObject(String name, String code)
          Converts the name to an URI, as that is the format expected by JavaFileObject
 
Method Summary
 CharSequence getCharContent(boolean ignoreEncodingErrors)
           
 String getQualifiedName()
           
 String getSourceCode()
           
 void setQualifiedName(String qualifiedName)
           
 void setSourceCode(String sourceCode)
           
 
Methods inherited from class javax.tools.SimpleJavaFileObject
delete, getAccessLevel, getKind, getLastModified, getName, getNestingKind, isNameCompatible, openInputStream, openOutputStream, openReader, openWriter, toString, toUri
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DynamicJavaSourceCodeObject

public DynamicJavaSourceCodeObject(String name,
                                   String code)
Converts the name to an URI, as that is the format expected by JavaFileObject

Parameters:
fully - qualified name given to the class file
code - the source code string
Method Detail

getCharContent

public CharSequence getCharContent(boolean ignoreEncodingErrors)
                            throws IOException
Specified by:
getCharContent in interface FileObject
Overrides:
getCharContent in class SimpleJavaFileObject
Throws:
IOException

getQualifiedName

public String getQualifiedName()

setQualifiedName

public void setQualifiedName(String qualifiedName)

getSourceCode

public String getSourceCode()

setSourceCode

public void setSourceCode(String sourceCode)


Copyright © 2014. All rights reserved.