private void directSetter ( Field field ) { GeneratorAdapter mg = new GeneratorAdapter ( Opcodes . ACC_PUBLIC , getMethod ( void . class , "set" , Object . class , Object . class ) , setterSignature ( ) , new Type [ 0 ] , classWriter ) ; // Simply access by field // ((classType)object).fieldName = (valueType)value; mg . loadArg ( 0 ) ; mg . checkCast ( Type . getType ( field . getDeclaringClass ( ) ) ) ; mg . loadArg ( 1 ) ; if ( field . getType ( ) . isPrimitive ( ) ) { mg . unbox ( Type . getType ( field . getType ( ) ) ) ; } else { mg . checkCast ( Type . getType ( field . getType ( ) ) ) ; } mg . putField ( Type . getType ( field . getDeclaringClass ( ) ) , field . getName ( ) , Type . getType ( field . getType ( ) ) ) ; mg . returnValue ( ) ; mg . endMethod ( ) ; }
Generates a setter that set the value by directly accessing the class field .