org.apache.openjpa.enhance
Class PCDataGenerator

java.lang.Object
  extended by org.apache.openjpa.enhance.DynamicStorageGenerator
      extended by org.apache.openjpa.enhance.PCDataGenerator
Direct Known Subclasses:
DataCachePCDataGenerator

public class PCDataGenerator
extends DynamicStorageGenerator

Generates PCDataGenerator.DynamicPCData instances which avoid primitve wrappers to optimize memory use and performance at the cost of slightly higher startup time.

Since:
0.3.2
Author:
Steve Kim

Nested Class Summary
static interface PCDataGenerator.DynamicPCData
          Dynamic PCDatas generated will implement this interface to simplify initialization.
 
Field Summary
protected static String POSTFIX
           
 
Fields inherited from class org.apache.openjpa.enhance.DynamicStorageGenerator
POLICY_EMPTY, POLICY_EXCEPTION, POLICY_SILENT
 
Constructor Summary
PCDataGenerator(OpenJPAConfiguration conf)
           
 
Method Summary
protected  void addVersionMethods(BCClass bc)
          Add methods for loading and storing version data.
protected  void callAbstractPCData(BCClass bc, String name, Class retType, Class[] args)
          Add method which defers to AbstractPCData.
protected  void declareClasses(BCClass bc)
          Add interface or superclass declarations to the generated class.
protected  void decorate(BCClass bc, ClassMetaData meta)
          Apply additional decoration to generated class.
protected  void decorate(Object obj, BCClass bc, int[] types)
          Decorate the generated class.
protected  void finish(PCDataGenerator.DynamicPCData data, ClassMetaData meta)
          Perform any final actions before the pcdata is returned to client code.
 PCData generatePCData(Object oid, ClassMetaData meta)
          Return a PCDataGenerator.DynamicPCData instance for the given oid and metadata.
protected  String getClassName(Object obj)
          Return a class name to use for the given user key.
 OpenJPAConfiguration getConfiguration()
          Return the configuration.
protected  int getCreateFieldMethods(int typeCode)
          Return the policy constant for how to create type methods.
protected  String getUniqueName(Class type)
          Creates a unique name for the given type's pcdata implementation.
protected  int replaceType(FieldMetaData fmd)
          Return a valid JavaTypes constant for the given field
protected  void setTarget(Instruction ins, Collection jumps)
          Set the collection of JumpInstructions to the given instruction, clearing the collection in the process.
protected  boolean usesImplData(ClassMetaData meta)
          Whether the given type might have cacheable class-level impl data.
protected  boolean usesImplData(FieldMetaData fmd)
          Whether the given field might have cacheable impl data.
protected  boolean usesIntermediate(FieldMetaData fmd)
          Whether the given field uses a cacheable intermediate value.
 
Methods inherited from class org.apache.openjpa.enhance.DynamicStorageGenerator
addBeanField, createFactory, forType, generateStorage, getFieldAccess, getFieldName, getWrapper, getWrapper, isCompatible, replaceMethod, throwException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POSTFIX

protected static final String POSTFIX
See Also:
Constant Field Values
Constructor Detail

PCDataGenerator

public PCDataGenerator(OpenJPAConfiguration conf)
Method Detail

getConfiguration

public OpenJPAConfiguration getConfiguration()
Return the configuration.


generatePCData

public PCData generatePCData(Object oid,
                             ClassMetaData meta)
Return a PCDataGenerator.DynamicPCData instance for the given oid and metadata.


finish

protected void finish(PCDataGenerator.DynamicPCData data,
                      ClassMetaData meta)
Perform any final actions before the pcdata is returned to client code.


getCreateFieldMethods

protected int getCreateFieldMethods(int typeCode)
Description copied from class: DynamicStorageGenerator
Return the policy constant for how to create type methods.

Overrides:
getCreateFieldMethods in class DynamicStorageGenerator

declareClasses

protected void declareClasses(BCClass bc)
Description copied from class: DynamicStorageGenerator
Add interface or superclass declarations to the generated class.

Overrides:
declareClasses in class DynamicStorageGenerator

getClassName

protected final String getClassName(Object obj)
Description copied from class: DynamicStorageGenerator
Return a class name to use for the given user key. By default, returns the stringified key prefixed by PREFIX.

Overrides:
getClassName in class DynamicStorageGenerator

getUniqueName

protected String getUniqueName(Class type)
Creates a unique name for the given type's pcdata implementation.


decorate

protected final void decorate(Object obj,
                              BCClass bc,
                              int[] types)
Description copied from class: DynamicStorageGenerator
Decorate the generated class.

Overrides:
decorate in class DynamicStorageGenerator

decorate

protected void decorate(BCClass bc,
                        ClassMetaData meta)
Apply additional decoration to generated class.


addVersionMethods

protected void addVersionMethods(BCClass bc)
Add methods for loading and storing version data.


replaceType

protected int replaceType(FieldMetaData fmd)
Return a valid JavaTypes constant for the given field


usesIntermediate

protected boolean usesIntermediate(FieldMetaData fmd)
Whether the given field uses a cacheable intermediate value.


usesImplData

protected boolean usesImplData(ClassMetaData meta)
Whether the given type might have cacheable class-level impl data.


usesImplData

protected boolean usesImplData(FieldMetaData fmd)
Whether the given field might have cacheable impl data.


callAbstractPCData

protected void callAbstractPCData(BCClass bc,
                                  String name,
                                  Class retType,
                                  Class[] args)
Add method which defers to AbstractPCData.


setTarget

protected void setTarget(Instruction ins,
                         Collection jumps)
Set the collection of JumpInstructions to the given instruction, clearing the collection in the process.



Copyright © 2006 Apache Software Foundation. All Rights Reserved.