|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.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_PC
|
static int |
ENHANCER_VERSION
|
static String |
ISDETACHEDSTATEDEFINITIVE
|
static String |
PRE
|
Constructor Summary | |
---|---|
PCEnhancer(MetaDataRepository repos,
serp.bytecode.BCClass type,
ClassMetaData meta)
Constructor. |
|
PCEnhancer(OpenJPAConfiguration conf,
serp.bytecode.BCClass type,
ClassMetaData meta)
Constructor. |
|
PCEnhancer(OpenJPAConfiguration conf,
serp.bytecode.BCClass type,
MetaDataRepository repos)
Deprecated. use PCEnhancer(OpenJPAConfiguration, BCClass,
MetaDataRepository, ClassLoader) instead. |
|
PCEnhancer(OpenJPAConfiguration conf,
serp.bytecode.BCClass type,
MetaDataRepository repos,
ClassLoader loader)
Constructor. |
|
PCEnhancer(OpenJPAConfiguration conf,
Class type)
Constructor. |
|
PCEnhancer(OpenJPAConfiguration conf,
ClassMetaData meta)
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 . |
BytecodeWriter |
getBytecodeWriter()
Return the current BytecodeWriter to write to or null if none. |
boolean |
getCreateSubclass()
Whether the enhancer should make its arguments persistence-capable, or generate a persistence-capable subclass. |
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. |
serp.bytecode.BCClass |
getManagedTypeBytecode()
Return the bytecode representation of the managed class being manipulated. |
ClassMetaData |
getMetaData()
Return the metadata for the class being manipulated, or null if not a persistent type. |
serp.bytecode.BCClass |
getPCBytecode()
Return the bytecode representation of the persistence-capable class being manipulated. |
boolean |
getRedefine()
Whether the enhancer should mutate its arguments, or just run validation and optional subclassing logic on them. |
Class |
getType(ClassMetaData meta)
Return the concrete type for the given class, i.e. |
boolean |
isAlreadyRedefined()
Whether the type that this instance is enhancing has already been redefined. |
boolean |
isAlreadySubclassed()
Whether the type that this instance is enhancing has already been subclassed in this instance's environment classloader. |
static boolean |
isPCSubclassName(String className)
Whether or not className is the name for a
dynamically-created persistence-capable subclass. |
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. |
static boolean |
run(String[] args,
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(BytecodeWriter writer)
Set the BytecodeWriter to write the bytecode to or null if none. |
void |
setCreateSubclass(boolean subclass)
Whether the enhancer should make its arguments persistence-capable, or generate a persistence-capable subclass. |
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. |
void |
setRedefine(boolean redefine)
Whether the enhancer should mutate its arguments, or just run validation and optional subclassing logic on them. |
static String |
toManagedTypeName(String className)
If className is a dynamically-created persistence-capable
subclass name, returns the name of the class that it subclasses. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int ENHANCER_VERSION
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 String PRE
public static final String ISDETACHEDSTATEDEFINITIVE
Constructor Detail |
---|
public PCEnhancer(OpenJPAConfiguration conf, Class type)
type
from conf
's
repository.
public PCEnhancer(OpenJPAConfiguration conf, ClassMetaData meta)
meta
by converting back to a class
and then loading from conf
's repository.
public PCEnhancer(OpenJPAConfiguration conf, serp.bytecode.BCClass type, MetaDataRepository repos)
PCEnhancer(OpenJPAConfiguration, BCClass,
MetaDataRepository, ClassLoader)
instead.
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, MetaDataRepository repos, ClassLoader loader)
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 filesloader
- the environment classloader to use for loading
classes and resources.public PCEnhancer(MetaDataRepository repos, serp.bytecode.BCClass type, ClassMetaData meta)
repos
- 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 filestype
- the bytecode representation fo the type to
enhance; this can be created from any stream or filemeta
- the metadata to use for processing this type.public PCEnhancer(OpenJPAConfiguration conf, serp.bytecode.BCClass type, ClassMetaData meta)
Method Detail |
---|
public static boolean isPCSubclassName(String className)
className
is the name for a
dynamically-created persistence-capable subclass.
public static String toManagedTypeName(String className)
className
is a dynamically-created persistence-capable
subclass name, returns the name of the class that it subclasses.
Otherwise, returns className
.
public serp.bytecode.BCClass getPCBytecode()
public serp.bytecode.BCClass getManagedTypeBytecode()
getPCBytecode()
,
except when running the enhancer to redefine and subclass
existing persistent types.
public ClassMetaData getMetaData()
public boolean getAddDefaultConstructor()
public void setAddDefaultConstructor(boolean addDefaultConstructor)
public boolean getRedefine()
setCreateSubclass(true)
.
public void setRedefine(boolean redefine)
setCreateSubclass(true)
.
public boolean isAlreadyRedefined()
public boolean isAlreadySubclassed()
public boolean getCreateSubclass()
public void setCreateSubclass(boolean subclass)
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)
Configuration
; optional.OpenJPAConfiguration
can be
set by using their names and supplying a value; for example:
public static boolean run(String[] args, Options opts)
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 |
This documentation is deprecated and will be removed in the next release of WebLogic Server.