Class ReplaceField


  • public class ReplaceField
    extends ClassMethod
    Method to generate the method "dnReplaceField" using ASM.
     public void dnReplaceField(int fieldIndex)
     {
         if (dnStateManager == null)
             throw new IllegalStateException("state manager is null");
         switch (fieldIndex)
         {
             case 0:
             {
                 MyClass ref = this;
                 ref.param1 = (MyOtherClass) ref.dnStateManager.replacingObjectField(this, fieldIndex);
                 break;
             }
             default:
                 throw new IllegalArgumentException("out of field index :" + fieldIndex);
         }
     }
     
    or with superclass
     public void dnReplaceField(int fieldIndex)
     {
         if (dnStateManager == null)
             throw new IllegalStateException("state manager is null");
         switch (fieldIndex - dnInheritedFieldCount)
         {
             case 0:
             {
                 MyClass ref = this;
                 ref.param1 = (MyOtherClass)ref.dnStateManager.replacingStringField(this, fieldIndex);
                 break;
             }
             default:
                 super.dnReplaceField(fieldIndex);
         }
     }
     
    • Constructor Detail

      • ReplaceField

        public ReplaceField​(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