org.objectweb.speedo.generation.enhancer
Class EnhancerComponent
java.lang.Object
|
+--org.objectweb.speedo.generation.lib.AbstractGeneratorComponent
|
+--org.objectweb.speedo.generation.enhancer.EnhancerComponent
- All Implemented Interfaces:
- GeneratorComponent
- Direct Known Subclasses:
- AccessEnhancer, MetaDataAnalyzer, PersistenceAwareEnhancer, PrivateFieldModifier
- public abstract class EnhancerComponent
- extends AbstractGeneratorComponent
Abstract enhancer component. Provides methods to read and write classes to
or from the file system.
Adapted from loadXXX and writeXXX methods in EnhancerTool.
Field Summary |
protected boolean |
isSrcJar
Indicates whether the .class files would be found in an
archive. |
Method Summary |
protected org.objectweb.asm.ClassReader |
loadJavaClass(boolean isSrcJar,
java.lang.String completeName,
java.lang.String srcFiles,
boolean remove)
Loads a specified JDO Instance placed indifferently in a directory or in
a .jar archive. |
protected org.objectweb.asm.ClassReader |
loadJavaClass(boolean isSrcJar,
java.lang.String completeName,
java.lang.String srcFiles,
boolean remove,
java.lang.String storeDir)
Loads a specified JDO Instance placed indifferently in a directory or in
a .jar archive and store it into a new directory. |
protected void |
writeJavaClass(java.lang.String name,
org.objectweb.asm.ClassWriter jclass,
java.lang.String srcFiles)
Saves the new bytecode of the specified Java class under a specified base
directory. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
isSrcJar
protected boolean isSrcJar
- Indicates whether the
.class
files would be found in an
archive.
EnhancerComponent
public EnhancerComponent()
- Constructs an
EnhancerComponent
.
loadJavaClass
protected org.objectweb.asm.ClassReader loadJavaClass(boolean isSrcJar,
java.lang.String completeName,
java.lang.String srcFiles,
boolean remove)
throws SpeedoEnhancerException
- Loads a specified JDO Instance placed indifferently in a directory or in
a
.jar
archive.
- Parameters:
isSrcJar
- indicates whether the .class
file would be
found in an archivecompleteName
- the name of the Java class to be loadedsrcFiles
- location of the .jar
file or base directory
of .class
file- Returns:
- the JavaClass loaded
- Throws:
SpeedoEnhancerException
- if the file cannot be loaded
loadJavaClass
protected org.objectweb.asm.ClassReader loadJavaClass(boolean isSrcJar,
java.lang.String completeName,
java.lang.String srcFiles,
boolean remove,
java.lang.String storeDir)
throws SpeedoEnhancerException
- Loads a specified JDO Instance placed indifferently in a directory or in
a
.jar
archive and store it into a new directory.
- Parameters:
isSrcJar
- indicates whether the .class
file would be
found in an archivecompleteName
- the name of the Java class to be loadedsrcFiles
- location of the .jar
file or base directory
of .class
filestoreDir
- location of the base directory where the java class
should be stored- Returns:
- the JavaClass loaded
- Throws:
SpeedoEnhancerException
- if the file cannot be loaded
writeJavaClass
protected void writeJavaClass(java.lang.String name,
org.objectweb.asm.ClassWriter jclass,
java.lang.String srcFiles)
throws SpeedoEnhancerException
- Saves the new bytecode of the specified Java class under a specified base
directory. The file's location is created if necessary.
- Parameters:
jclass
- the Java class that has to be savedsrcFiles
- the base directory where it has to be saved- Throws:
SpeedoEnhancerException
- if the file cannot be written