com.github.talberto.easybeans.gen.tools
Class DynamicJavaSourceCodeObject
java.lang.Object
javax.tools.SimpleJavaFileObject
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
| Methods inherited from class javax.tools.SimpleJavaFileObject |
delete, getAccessLevel, getKind, getLastModified, getName, getNestingKind, isNameCompatible, openInputStream, openOutputStream, openReader, openWriter, toString, toUri |
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 filecode - the source code string
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.