Class MakeDirty

java.lang.Object
org.datanucleus.enhancer.ClassMethod
org.datanucleus.enhancer.methods.MakeDirty

public class MakeDirty extends ClassMethod
Method to generate the method "dnMakeDirty" using ASM.
 public void dnMakeDirty(String fieldName)
 {
     if (dnStateManager != null)
         dnStateManager.makeDirty(this, fieldName);
     if (dnIsDetached() && fieldName != null) 
     {
         String fldName = null;
         if (fieldName.indexOf('.') ≥ 0)
             fldName = fieldName.substring(fieldName.lastIndexOf('.') + 1);
         else
             fldName = fieldName;
         for (int i = 0; i < dnFieldNames.length; i++) 
         {
             if (dnFieldNames[i].equals(fldName)) 
             {
                 if (((BitSet) dnDetachedState[2]).get(i + dnInheritedFieldCount))
                     ((BitSet) dnDetachedState[3]).set(i + dnInheritedFieldCount);
                 else
                     throw new JDODetachedFieldAccessException("You have just attempted to access a field/property");
                 break;
             }
         }
     }
 }
 
and if not detachable
public void dnMakeDirty(String fieldName)
 {
     if (dnStateManager != null)
         dnStateManager.makeDirty(this, fieldName);
 }
 
TODO This currently doesnt cater for a fully-qualified field where the class name part doesnt define a field at that level
  • Constructor Details

    • MakeDirty

      public MakeDirty(ClassEnhancer enhancer, String name, int access, Object returnType, Object[] argTypes, String[] argNames)
      Constructor.
      Parameters:
      enhancer - ClassEnhancer
      name - Name of method
      access - Access type
      returnType - Return type
      argTypes - Argument types
      argNames - Argument names
  • Method Details

    • getInstance

      public static MakeDirty getInstance(ClassEnhancer enhancer)
    • execute

      public void execute()
      Method to add the contents of the class method.
      Specified by:
      execute in class ClassMethod