org.datanucleus.enhancer.bcel
Class BCELClassMethod

java.lang.Object
  extended by org.datanucleus.enhancer.ClassMethod
      extended by org.datanucleus.enhancer.bcel.BCELClassMethod
Direct Known Subclasses:
CheckReadMethod, CheckWriteMethod, DefaultConstructor, InitFieldFlags, InitFieldNames, InitFieldTypes, InitPersistenceCapableSuperClass, IsXXXMethod, JdoCopyField, JdoCopyFields, JdoCopyKeyFieldsFromObjectId, JdoCopyKeyFieldsFromObjectId2, JdoCopyKeyFieldsToObjectId, JdoCopyKeyFieldsToObjectId2, JdoGetManagedFieldCount, JdoIsDetached, JdoIsDirty, JdoMakeDirty, JdoNewInstance1, JdoNewInstance2, JdoNewObjectIdInstance1, JdoNewObjectIdInstance2, JdoProvideField, JdoReplaceDetachedState, JdoReplaceField, JdoReplaceFlags, JdoReplaceStateManager, LoadClass, MediateReadMethod, MediateWriteMethod, NormalGetMethod, NormalSetMethod, ParentManagedFieldNum, ReplaceMethodCallback, SimpleStateManagerCall, SuperClone, SwitchInverseTarget, SwitchTarget, WriteObject

public abstract class BCELClassMethod
extends ClassMethod

Representation of a method required by an enhanced class, for use by BCEL.

Version:
$Revision: 1.4 $

Field Summary
protected  org.apache.bcel.generic.ClassGen classGen
          target ClassGen instance
protected  java.lang.String className
          target class name
protected  BCELClassMetaData cmd
          ClassMetaData for the class
protected  org.apache.bcel.generic.ConstantPoolGen constantPoolGen
          target ConstantPoolGen instance
protected  org.apache.bcel.generic.InstructionFactory factory
          InstructionFactory instance
protected  org.apache.bcel.generic.InstructionList il
          InstructionList instance
protected static org.datanucleus.util.Localiser LOCALISER
          Localisation of messages
protected  org.apache.bcel.generic.MethodGen methodGen
          MethodGen instance
protected  boolean synthetic
          is synthetic
 
Fields inherited from class org.datanucleus.enhancer.ClassMethod
access, argNames, argTypes, enhancer, exceptions, methodName, returnType
 
Constructor Summary
BCELClassMethod(java.lang.String methodName, int permissions, org.apache.bcel.generic.Type returnType, org.apache.bcel.generic.Type[] argTypes, java.lang.String[] argNames, boolean synthetic, BCELClassEnhancer enhancer)
          Constructor.
 
Method Summary
 void close()
          Method to close the definition of the class method
protected  org.apache.bcel.generic.InstructionHandle createThrowException(java.lang.String newException, java.lang.String message)
          Helper method to create a throw exception instruction.
protected  org.apache.bcel.generic.InstructionHandle createThrowException(java.lang.String newException, java.lang.String message, org.apache.bcel.generic.Instruction intMessage)
          Helper method to create a throw exception instruction.
 void execute()
          Method to add the contents of the class method.
protected  BCELClassEnhancer getClassEnhancer()
          Convenience accessor for the BCELClassEnhancer
 void initialise()
          Method to initialise the class method.
 
Methods inherited from class org.datanucleus.enhancer.ClassMethod
equals, getAccess, getMethodAdditionMessage, getName, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALISER

protected static org.datanucleus.util.Localiser LOCALISER
Localisation of messages


factory

protected org.apache.bcel.generic.InstructionFactory factory
InstructionFactory instance


il

protected org.apache.bcel.generic.InstructionList il
InstructionList instance


methodGen

protected org.apache.bcel.generic.MethodGen methodGen
MethodGen instance


synthetic

protected boolean synthetic
is synthetic


classGen

protected org.apache.bcel.generic.ClassGen classGen
target ClassGen instance


className

protected java.lang.String className
target class name


constantPoolGen

protected org.apache.bcel.generic.ConstantPoolGen constantPoolGen
target ConstantPoolGen instance


cmd

protected BCELClassMetaData cmd
ClassMetaData for the class

Constructor Detail

BCELClassMethod

public BCELClassMethod(java.lang.String methodName,
                       int permissions,
                       org.apache.bcel.generic.Type returnType,
                       org.apache.bcel.generic.Type[] argTypes,
                       java.lang.String[] argNames,
                       boolean synthetic,
                       BCELClassEnhancer enhancer)
Constructor.

Parameters:
methodName - method name
permissions - bcel method type
returnType - return type
argTypes - argment types
argNames - argment names
synthetic - synthetic method
enhancer - Class Enhancer
Method Detail

getClassEnhancer

protected BCELClassEnhancer getClassEnhancer()
Convenience accessor for the BCELClassEnhancer

Returns:
ClassEnhancer for BCEL

initialise

public void initialise()
Method to initialise the class method.

Specified by:
initialise in class ClassMethod

execute

public void execute()
Method to add the contents of the class method.

Specified by:
execute in class ClassMethod

close

public void close()
Method to close the definition of the class method

Overrides:
close in class ClassMethod

createThrowException

protected org.apache.bcel.generic.InstructionHandle createThrowException(java.lang.String newException,
                                                                         java.lang.String message,
                                                                         org.apache.bcel.generic.Instruction intMessage)
Helper method to create a throw exception instruction.
this method generate below code...
throw new [newExceptin param class]([message param]+[intMessage param]);

Parameters:
newException - throw exception
message - exception message
intMessage - exception message append ,like ICONST_2 or ILOAD_1
Returns:
first InstructionHandle

createThrowException

protected org.apache.bcel.generic.InstructionHandle createThrowException(java.lang.String newException,
                                                                         java.lang.String message)
Helper method to create a throw exception instruction.
this method generate below code...
throw new [newExceptin param class]([message param]);

Parameters:
newException - throw exception
message - exception message
Returns:
first InstructionHandle


Copyright © 2009. All Rights Reserved.