|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.openjpa.enhance.PCEnhancer
public class PCEnhancer
Bytecode enhancer used to enhance persistent classes from metadata. The enhancer must be invoked on all persistence-capable and persistence aware classes.
Nested Class Summary | |
---|---|
static interface |
PCEnhancer.AuxiliaryEnhancer
Plugin interface for additional enhancement. |
static class |
PCEnhancer.Flags
Run flags. |
Field Summary | |
---|---|
static int |
ENHANCE_AWARE
|
static int |
ENHANCE_INTERFACE
|
static int |
ENHANCE_NONE
|
static int |
ENHANCE_OID
|
static int |
ENHANCE_PC
|
Constructor Summary | |
---|---|
PCEnhancer(OpenJPAConfiguration conf,
serp.bytecode.BCClass type,
ClassMetaData meta)
Constructor. |
|
PCEnhancer(OpenJPAConfiguration conf,
serp.bytecode.BCClass type,
MetaDataRepository repos)
Constructor. |
|
PCEnhancer(OpenJPAConfiguration conf,
Class type)
Constructor. |
|
PCEnhancer(OpenJPAConfiguration conf,
ClassMetaData type)
Constructor. |
Method Summary | |
---|---|
boolean |
getAddDefaultConstructor()
A boolean indicating whether the enhancer should add a no-args constructor if one is not already present in the class. |
PCEnhancer.AuxiliaryEnhancer[] |
getAuxiliaryEnhancers()
Gets the auxiliary enhancers registered as services . |
serp.bytecode.BCClass |
getBytecode()
Return the bytecode representation of the class being manipulated. |
BytecodeWriter |
getBytecodeWriter()
Return the current BytecodeWriter to write to or null if none. |
File |
getDirectory()
The base build directory to generate code to. |
boolean |
getEnforcePropertyRestrictions()
Whether to fail if the persistent type uses property access and bytecode analysis shows that it may be violating OpenJPA's property access restrictions. |
ClassMetaData |
getMetaData()
Return the metadata for the class being manipulated, or null if not a persistent type. |
Collection |
getObjectIdBytecode()
Return the bytecode representations of any oid classes that must be manipulated. |
Class |
getType(ClassMetaData meta)
Return the concrete type for the given class, i.e. |
static void |
main(String[] args)
Usage: java org.apache.openjpa.enhance.PCEnhancer [option]* <class name | .java file | .class file | .jdo file>+ Where the following options are recognized. |
void |
record()
Write the generated bytecode. |
int |
run()
Perform bytecode enhancements. |
static boolean |
run(OpenJPAConfiguration conf,
String[] args,
Options opts)
Run the tool. |
static boolean |
run(OpenJPAConfiguration conf,
String[] args,
PCEnhancer.Flags flags,
MetaDataRepository repos,
BytecodeWriter writer,
ClassLoader loader)
Enhance the given classes. |
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(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 |
setEnforcePropertyRestrictions(boolean fail)
Whether to fail if the persistent type uses property access and bytecode analysis shows that it may be violating OpenJPA's property access restrictions. |
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_INTERFACE
public static final int ENHANCE_PC
public static final int ENHANCE_OID
Constructor Detail |
---|
public PCEnhancer(OpenJPAConfiguration conf, Class type)
public PCEnhancer(OpenJPAConfiguration conf, ClassMetaData type)
public PCEnhancer(OpenJPAConfiguration conf, serp.bytecode.BCClass type, MetaDataRepository 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 metadata filespublic PCEnhancer(OpenJPAConfiguration conf, serp.bytecode.BCClass type, ClassMetaData meta)
Method Detail |
---|
public serp.bytecode.BCClass getBytecode()
public Collection getObjectIdBytecode()
public ClassMetaData getMetaData()
public boolean getAddDefaultConstructor()
public void setAddDefaultConstructor(boolean addDefaultConstructor)
public boolean getEnforcePropertyRestrictions()
public void setEnforcePropertyRestrictions(boolean fail)
public File getDirectory()
public void setDirectory(File dir)
public BytecodeWriter getBytecodeWriter()
BytecodeWriter
to write to or null if none.
public void setBytecodeWriter(BytecodeWriter writer)
BytecodeWriter
to write the bytecode to or null if none.
public int run()
ENHANCE_*
constantpublic void record() throws IOException
IOException
public PCEnhancer.AuxiliaryEnhancer[] getAuxiliaryEnhancers()
services
.
public Class getType(ClassMetaData meta)
public static void main(String[] args) throws IOException
Configuration
; optional.OpenJPAConfiguration
can be
set by using their names and supplying a value; for example:
IOException
public static boolean run(OpenJPAConfiguration conf, String[] args, Options opts) throws IOException
IOException
public static boolean run(OpenJPAConfiguration conf, String[] args, PCEnhancer.Flags flags, MetaDataRepository repos, BytecodeWriter writer, ClassLoader loader) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |