|
SolarMetric Kodo JDO 3.2.4 generated on January 7 2005 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--kodo.enhance.JDOEnhancer
Bytecode enhancer used to create PersistenceCapable
classes from
JDO metadata. The bytecode modifications made by this enhancer are
consistent with the description of the reference enhancer
in the JDO 1.0 Specification.
The enhancer must be invoked on all persistence-capable and persistence aware classes before running any application that uses JDO. Additionally, before the enhancer can be invoked, JDO metadata must be available for all persistence-capable types.
Field Summary | |
static int |
ENHANCE_AWARE
|
static int |
ENHANCE_NONE
|
static int |
ENHANCE_PC
|
Constructor Summary | |
JDOEnhancer(JDOConfiguration conf,
serp.bytecode.BCClass type,
JDOMetaDataRepository repos)
Constructor. |
|
JDOEnhancer(JDOConfiguration conf,
Class type)
Constructor. |
|
JDOEnhancer(JDOConfiguration conf,
ClassMetaData type)
Constructor. |
Method Summary | |
int |
enhance()
Perform bytecode enhancements. |
boolean |
getAddDefaultConstructor()
A boolean indicating whether the enhancer should add a no-args constructor if one is not already present in the class. |
serp.bytecode.BCClass |
getBytecode()
Return the bytecode representation of the class being enhanced. |
com.solarmetric.util.BytecodeWriter |
getBytecodeWriter()
Return the current BytecodeWriter to write to
or null if none. |
ClassMetaData |
getClassMetaData()
Return the ClassMetaData object for this class,
or null if not persistence capable. |
File |
getDirectory()
The base build directory to generate code to. |
ClassMetaData |
getMetaData()
Return the metadata for the class being enhanced. |
Class |
getType()
Return the type being enhanced. |
boolean |
isPersistenceCapable()
Return true if the class being enhanced is a PersistenceCapable type. |
static void |
main(String[] args)
Usage: java kodo.enhance.JDOEnhancer [option]* <class name | .java file | .class file | .jdo file>+ |
static boolean |
run(JDOConfiguration conf,
String[] args,
JDOMetaDataRepository repos,
File dir,
ClassLoader loader,
com.solarmetric.util.BytecodeWriter writer,
boolean defCons,
boolean tmpLoad)
Enhance the given class. |
static boolean |
run(JDOConfiguration conf,
String[] args,
serp.util.Options opts)
Run the tool. |
void |
setAddDefaultConstructor(boolean addDefaultConstructor)
A boolean indicating whether the enhancer should add a no-args constructor if one is not already present in the class. |
void |
setBytecodeWriter(com.solarmetric.util.BytecodeWriter writer)
Set the BytecodeWriter to write the bytecode
to or null if none. |
void |
setDirectory(File dir)
The base build directory to generate code to. |
void |
writeBytecode()
Write the generated bytecode. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int ENHANCE_NONE
public static final int ENHANCE_AWARE
public static final int ENHANCE_PC
Constructor Detail |
public JDOEnhancer(JDOConfiguration conf, Class type)
public JDOEnhancer(JDOConfiguration conf, ClassMetaData type)
public JDOEnhancer(JDOConfiguration conf, serp.bytecode.BCClass type, JDOMetaDataRepository repos)
type
- the bytecode representation fo the type to
enhance; this can be created from any stream or filerepos
- A metadata repository to use for metadata access,
or null to create a new reporitory; the repository
from the given configuration isn't used by default
because the configuration might be an
implementation-specific subclass whose metadata
required more than just base JDO metadata filesMethod Detail |
public File getDirectory()
public void setDirectory(File dir)
public boolean getAddDefaultConstructor()
public void setAddDefaultConstructor(boolean addDefaultConstructor)
public serp.bytecode.BCClass getBytecode()
public Class getType()
public ClassMetaData getMetaData()
public boolean isPersistenceCapable()
PersistenceCapable
type.public ClassMetaData getClassMetaData()
ClassMetaData
object for this class,
or null if not persistence capable.public com.solarmetric.util.BytecodeWriter getBytecodeWriter()
BytecodeWriter
to write to
or null if none.public void setBytecodeWriter(com.solarmetric.util.BytecodeWriter writer)
BytecodeWriter
to write the bytecode
to or null if none.public int enhance()
public void writeBytecode() throws IOException
public static void main(String[] args) throws IOException
Usage: java kodo.enhance.JDOEnhancer [option]* <class name | .java file | .class file | .jdo file>+
Where the following options are recognized.
Configuration
; optional.JDOConfiguration
can be
set by using their names and supplying a value; for example:
-licenseKey adslfja83r3lkadf
Each additional argument can be either the full class name of the
type to enhance, the path to the .java file for the type, the path to
the .class file for the type, or the path to a .jdo file listing one
or more types to enhance.
If the type being enhanced has JDO metadata, it will be enhanced as a
persistence capable class. If not, it will be considered a persistence
aware class, and all access to fields of persistence capable classes
will be replaced by the appropriate get/set method. If the type
explicitly declares the PersistenceCapable
interface, it will
not be enhanced. Thus, it is safe to invoke the enhancer on classes
that are already enhanced.
public static boolean run(JDOConfiguration conf, String[] args, serp.util.Options opts) throws IOException
public static boolean run(JDOConfiguration conf, String[] args, JDOMetaDataRepository repos, File dir, ClassLoader loader, com.solarmetric.util.BytecodeWriter writer, boolean defCons, boolean tmpLoad) throws IOException
conf
- configuration containing license key information,
logging information, etc.args
- the arguments to parse for classes to enhancerepos
- a metadata repository to use for metadata access,
or null to create a new repository; the repository
from the given configuration isn't used by default
because the configuration might be an
implementation-specific subclass whose function
requires more than just base JDO metadata filesdir
- the output directory, or null to overwrite original
class filedefCons
- indicates whether or not to add a no-args constructor
to a PC if one is not presenttmpLoad
- indicates whether or not to use a temporary class loaderIOException
- if unable to save enhanced bytecode
|
SolarMetric Kodo JDO 3.2.4 generated on January 7 2005 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |