|
||||||||||
| 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(java.lang.ClassLoader parentLoader)
|
|
| Method Summary | |
|---|---|
void |
assertTypeAccessible(java.lang.Class<?> type)
|
java.lang.ClassLoader |
compile(java.io.File sourceDir,
java.lang.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(java.io.File sourceDir,
java.io.File binDir)
Compiles a set of files contained in source directory, writing the class files to binDir |
byte[] |
compile(java.lang.String source,
java.lang.String packageName,
java.lang.String classSimpleName)
Compile and return the raw bytes of the class file. |
java.lang.Class<?> |
compileAndLoad(java.lang.String source,
java.lang.String packageName,
java.lang.String classSimpleName)
Compile and return the (generated) class. |
java.lang.String |
formatSource(java.lang.String code)
Format the source code using the Eclipse text formatter |
byte[] |
getBytes(java.lang.String className)
Gets the raw bytes of the classFile that was defined for the given className by this compiler. |
java.lang.Class<?> |
load(java.lang.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(java.lang.ClassLoader parentLoader)
| Method Detail |
|---|
public java.lang.String formatSource(java.lang.String code)
public void assertTypeAccessible(java.lang.Class<?> type)
throws java.lang.IllegalStateException
java.lang.IllegalStateException
public java.lang.Class<?> compileAndLoad(java.lang.String source,
java.lang.String packageName,
java.lang.String classSimpleName)
throws java.lang.ClassNotFoundException
source - packageName - classSimpleName -
java.lang.ClassNotFoundException
public byte[] compile(java.lang.String source,
java.lang.String packageName,
java.lang.String classSimpleName)
source - packageName - classSimpleName -
public java.lang.ClassLoader compile(java.io.File sourceDir,
java.lang.ClassLoader parent)
throws java.io.IOException
sourceDir - the directory (base) from which to find the java source filesparent - the parent ClassLoader to be set for the returned loader
java.io.IOException
public void compile(java.io.File sourceDir,
java.io.File binDir)
throws java.io.IOException
sourceDir - binDir -
java.io.IOException
public java.lang.Class<?> load(java.lang.String className,
byte[] data)
throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundExceptionpublic byte[] getBytes(java.lang.String className)
className -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||