|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectma.glasnost.orika.impl.generator.EclipseJdtCompiler
public class EclipseJdtCompiler
EclipseJdtCompiler leverages the eclipse jdt core to compile source code
provided in String format.
It can also make use of the source formatter tool to format source.
| Constructor Summary | |
|---|---|
EclipseJdtCompiler()
|
|
EclipseJdtCompiler(ClassLoader parentLoader)
|
|
| Method Summary | |
|---|---|
void |
assertTypeAccessible(Class<?> type)
|
ClassLoader |
compile(File sourceDir,
ClassLoader parent)
Compiles a set of files contained in source directory directly to bytes in memory, returning a ClassLoader which is able to access them. |
void |
compile(File sourceDir,
File binDir)
Compiles a set of files contained in source directory, writing the class files to binDir |
byte[] |
compile(String source,
String packageName,
String classSimpleName)
Compile and return the raw bytes of the class file. |
Class<?> |
compileAndLoad(String source,
String packageName,
String classSimpleName)
Compile and return the (generated) class. |
String |
formatSource(String code)
Format the source code using the Eclipse text formatter |
byte[] |
getBytes(String className)
Gets the raw bytes of the classFile that was defined for the given className by this compiler. |
Class<?> |
load(String className,
byte[] data)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public EclipseJdtCompiler()
public EclipseJdtCompiler(ClassLoader parentLoader)
| Method Detail |
|---|
public String formatSource(String code)
public void assertTypeAccessible(Class<?> type)
throws IllegalStateException
IllegalStateException
public Class<?> compileAndLoad(String source,
String packageName,
String classSimpleName)
throws ClassNotFoundException
source - packageName - classSimpleName -
ClassNotFoundException
public byte[] compile(String source,
String packageName,
String classSimpleName)
source - packageName - classSimpleName -
public ClassLoader compile(File sourceDir,
ClassLoader parent)
throws IOException
sourceDir - the directory (base) from which to find the java source filesparent - the parent ClassLoader to be set for the returned loader
IOException
public void compile(File sourceDir,
File binDir)
throws IOException
sourceDir - binDir -
IOException
public Class<?> load(String className,
byte[] data)
throws ClassNotFoundException
ClassNotFoundExceptionpublic byte[] getBytes(String className)
className -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||