org.datanucleus.enhancer.asm
Class JdoPropertySetterAdapter

java.lang.Object
  extended by org.objectweb.asm.MethodVisitor
      extended by org.datanucleus.enhancer.asm.JdoPropertySetterAdapter

public class JdoPropertySetterAdapter
extends org.objectweb.asm.MethodVisitor

Adapter for property setter methods in JDO-enabled classes. This adapter processes the setXXX method and

When detachable this will be (CHECK_WRITE variant)
 void setZZZ(YYY zzz)
 {
     if (aaaFlags != 0 && aaaStateManager != null)
         aaaStateManager.setStringField(this, 2, aaaGetZZZ(), zzz);
     else
     {
         aaaSetXXX(zzz);
         if (aaaIsDetached() == true)
             ((BitSet) aaaDetachedState[3]).set(2);
     }
 }
 
and when not detachable
 void setZZZ(YYY zzz)
 {
     if (aFlags > 0 && aaaStateManager != null)
         aaaStateManager.setObjectField(this, 2, aaaGetZZZ(), zzz);
     aaaSetXXX(zzz);
 }
 
There are other variants for MEDIATE_WRITE and NORMAL_WRITE


Field Summary
protected  ASMClassEnhancer enhancer
          The enhancer for this class.
protected static org.datanucleus.util.Localiser LOCALISER
          Localisation of messages.
protected  String methodDescriptor
          Descriptor for the method being adapted.
protected  String methodName
          Name for the method being adapted.
protected  org.datanucleus.metadata.AbstractMemberMetaData mmd
          MetaData for the property.
protected  org.objectweb.asm.MethodVisitor visitor
          Visitor for the aaaSetXXX method.
 
Fields inherited from class org.objectweb.asm.MethodVisitor
api, mv
 
Constructor Summary
JdoPropertySetterAdapter(org.objectweb.asm.MethodVisitor mv, ASMClassEnhancer enhancer, String methodName, String methodDesc, org.datanucleus.metadata.AbstractMemberMetaData mmd, org.objectweb.asm.ClassVisitor cv)
          Constructor for the method adapter.
 
Method Summary
static void generateSetXXXMethod(org.objectweb.asm.MethodVisitor mv, org.datanucleus.metadata.AbstractMemberMetaData mmd, String asmClassName, String asmClassDesc, boolean includeFrames)
          Convenience method to use the MethodVisitor to generate the code for the method setXXX() for the property with the specified MetaData.
 org.objectweb.asm.AnnotationVisitor visitAnnotation(String arg0, boolean arg1)
           
 org.objectweb.asm.AnnotationVisitor visitAnnotationDefault()
           
 void visitAttribute(org.objectweb.asm.Attribute arg0)
           
 void visitCode()
           
 void visitEnd()
          Method called at the end of visiting the setXXX method.
 void visitFieldInsn(int arg0, String arg1, String arg2, String arg3)
           
 void visitFrame(int arg0, int arg1, Object[] arg2, int arg3, Object[] arg4)
           
 void visitIincInsn(int arg0, int arg1)
           
 void visitInsn(int arg0)
           
 void visitIntInsn(int arg0, int arg1)
           
 void visitJumpInsn(int arg0, org.objectweb.asm.Label arg1)
           
 void visitLabel(org.objectweb.asm.Label arg0)
           
 void visitLdcInsn(Object arg0)
           
 void visitLineNumber(int arg0, org.objectweb.asm.Label arg1)
           
 void visitLocalVariable(String arg0, String arg1, String arg2, org.objectweb.asm.Label arg3, org.objectweb.asm.Label arg4, int arg5)
           
 void visitLookupSwitchInsn(org.objectweb.asm.Label arg0, int[] arg1, org.objectweb.asm.Label[] arg2)
           
 void visitMaxs(int arg0, int arg1)
           
 void visitMethodInsn(int arg0, String arg1, String arg2, String arg3)
           
 void visitMultiANewArrayInsn(String arg0, int arg1)
           
 org.objectweb.asm.AnnotationVisitor visitParameterAnnotation(int arg0, String arg1, boolean arg2)
           
 void visitTableSwitchInsn(int arg0, int arg1, org.objectweb.asm.Label arg2, org.objectweb.asm.Label... arg3)
           
 void visitTryCatchBlock(org.objectweb.asm.Label arg0, org.objectweb.asm.Label arg1, org.objectweb.asm.Label arg2, String arg3)
           
 void visitTypeInsn(int arg0, String arg1)
           
 void visitVarInsn(int arg0, int arg1)
           
 
Methods inherited from class org.objectweb.asm.MethodVisitor
visitInvokeDynamicInsn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALISER

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


enhancer

protected ASMClassEnhancer enhancer
The enhancer for this class.


methodName

protected String methodName
Name for the method being adapted.


methodDescriptor

protected String methodDescriptor
Descriptor for the method being adapted.


mmd

protected org.datanucleus.metadata.AbstractMemberMetaData mmd
MetaData for the property.


visitor

protected org.objectweb.asm.MethodVisitor visitor
Visitor for the aaaSetXXX method.

Constructor Detail

JdoPropertySetterAdapter

public JdoPropertySetterAdapter(org.objectweb.asm.MethodVisitor mv,
                                ASMClassEnhancer enhancer,
                                String methodName,
                                String methodDesc,
                                org.datanucleus.metadata.AbstractMemberMetaData mmd,
                                org.objectweb.asm.ClassVisitor cv)
Constructor for the method adapter.

Parameters:
mv - MethodVisitor
enhancer - ClassEnhancer for the class with the method
methodName - Name of the method
methodDesc - Method descriptor
mmd - MetaData for the property
cv - ClassVisitor
Method Detail

visitEnd

public void visitEnd()
Method called at the end of visiting the setXXX method. This is used to add the aaaSetXXX method with the same code as is present originally in the setXXX method.

Overrides:
visitEnd in class org.objectweb.asm.MethodVisitor

generateSetXXXMethod

public static void generateSetXXXMethod(org.objectweb.asm.MethodVisitor mv,
                                        org.datanucleus.metadata.AbstractMemberMetaData mmd,
                                        String asmClassName,
                                        String asmClassDesc,
                                        boolean includeFrames)
Convenience method to use the MethodVisitor to generate the code for the method setXXX() for the property with the specified MetaData.

Parameters:
mv - MethodVisitor
mmd - MetaData for the property
asmClassName - ASM class name for the owning class
asmClassDesc - ASM descriptor for the owning class

visitAnnotation

public org.objectweb.asm.AnnotationVisitor visitAnnotation(String arg0,
                                                           boolean arg1)
Overrides:
visitAnnotation in class org.objectweb.asm.MethodVisitor

visitAnnotationDefault

public org.objectweb.asm.AnnotationVisitor visitAnnotationDefault()
Overrides:
visitAnnotationDefault in class org.objectweb.asm.MethodVisitor

visitAttribute

public void visitAttribute(org.objectweb.asm.Attribute arg0)
Overrides:
visitAttribute in class org.objectweb.asm.MethodVisitor

visitCode

public void visitCode()
Overrides:
visitCode in class org.objectweb.asm.MethodVisitor

visitFieldInsn

public void visitFieldInsn(int arg0,
                           String arg1,
                           String arg2,
                           String arg3)
Overrides:
visitFieldInsn in class org.objectweb.asm.MethodVisitor

visitFrame

public void visitFrame(int arg0,
                       int arg1,
                       Object[] arg2,
                       int arg3,
                       Object[] arg4)
Overrides:
visitFrame in class org.objectweb.asm.MethodVisitor

visitIincInsn

public void visitIincInsn(int arg0,
                          int arg1)
Overrides:
visitIincInsn in class org.objectweb.asm.MethodVisitor

visitInsn

public void visitInsn(int arg0)
Overrides:
visitInsn in class org.objectweb.asm.MethodVisitor

visitIntInsn

public void visitIntInsn(int arg0,
                         int arg1)
Overrides:
visitIntInsn in class org.objectweb.asm.MethodVisitor

visitJumpInsn

public void visitJumpInsn(int arg0,
                          org.objectweb.asm.Label arg1)
Overrides:
visitJumpInsn in class org.objectweb.asm.MethodVisitor

visitLabel

public void visitLabel(org.objectweb.asm.Label arg0)
Overrides:
visitLabel in class org.objectweb.asm.MethodVisitor

visitLdcInsn

public void visitLdcInsn(Object arg0)
Overrides:
visitLdcInsn in class org.objectweb.asm.MethodVisitor

visitLineNumber

public void visitLineNumber(int arg0,
                            org.objectweb.asm.Label arg1)
Overrides:
visitLineNumber in class org.objectweb.asm.MethodVisitor

visitLocalVariable

public void visitLocalVariable(String arg0,
                               String arg1,
                               String arg2,
                               org.objectweb.asm.Label arg3,
                               org.objectweb.asm.Label arg4,
                               int arg5)
Overrides:
visitLocalVariable in class org.objectweb.asm.MethodVisitor

visitLookupSwitchInsn

public void visitLookupSwitchInsn(org.objectweb.asm.Label arg0,
                                  int[] arg1,
                                  org.objectweb.asm.Label[] arg2)
Overrides:
visitLookupSwitchInsn in class org.objectweb.asm.MethodVisitor

visitMaxs

public void visitMaxs(int arg0,
                      int arg1)
Overrides:
visitMaxs in class org.objectweb.asm.MethodVisitor

visitMethodInsn

public void visitMethodInsn(int arg0,
                            String arg1,
                            String arg2,
                            String arg3)
Overrides:
visitMethodInsn in class org.objectweb.asm.MethodVisitor

visitMultiANewArrayInsn

public void visitMultiANewArrayInsn(String arg0,
                                    int arg1)
Overrides:
visitMultiANewArrayInsn in class org.objectweb.asm.MethodVisitor

visitParameterAnnotation

public org.objectweb.asm.AnnotationVisitor visitParameterAnnotation(int arg0,
                                                                    String arg1,
                                                                    boolean arg2)
Overrides:
visitParameterAnnotation in class org.objectweb.asm.MethodVisitor

visitTableSwitchInsn

public void visitTableSwitchInsn(int arg0,
                                 int arg1,
                                 org.objectweb.asm.Label arg2,
                                 org.objectweb.asm.Label... arg3)
Overrides:
visitTableSwitchInsn in class org.objectweb.asm.MethodVisitor

visitTryCatchBlock

public void visitTryCatchBlock(org.objectweb.asm.Label arg0,
                               org.objectweb.asm.Label arg1,
                               org.objectweb.asm.Label arg2,
                               String arg3)
Overrides:
visitTryCatchBlock in class org.objectweb.asm.MethodVisitor

visitTypeInsn

public void visitTypeInsn(int arg0,
                          String arg1)
Overrides:
visitTypeInsn in class org.objectweb.asm.MethodVisitor

visitVarInsn

public void visitVarInsn(int arg0,
                         int arg1)
Overrides:
visitVarInsn in class org.objectweb.asm.MethodVisitor


Copyright © 2012. All Rights Reserved.