Class ProvideField


  • public class ProvideField
    extends ClassMethod
    Method to generate the method "dnProvideField" using ASM.
     public void dnProvideField(int fieldIndex)
     {
         if (dnStateManager == null)
             throw new IllegalStateException("state manager is null");
         switch (fieldIndex)
         {
             case 0:
                 dnStateManager.providedObjectField(this, fieldIndex, question);
                 break;
             default:
                 throw new IllegalArgumentException("out of field index :" + fieldIndex);
         }
     }
     
    and with a superclass
     public void dnProvideField(int fieldIndex)
     {
         if (dnStateManager == null)
             throw new IllegalStateException("state manager is null");
         switch (fieldIndex - dnInheritedFieldCount)
         {
             case 0:
                 dnStateManager.providedStringField(this, fieldIndex, extraInfo);
                 break;
             default:
                 super.dnProvideField(fieldIndex);
         }
     }
     
    with further minor changes when the class has no fields.
    • Constructor Detail

      • ProvideField

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