public class CopyField extends ClassMethod
protected final void dnCopyField(Answer obj, int index) { switch (index) { case 0: question = obj.question; break; default: throw new IllegalArgumentException("out of field index :" + index); } }or with superclass
protected final void dnCopyField(ComplexAnswer obj, int index) { switch (index - dnInheritedFieldCount) { case 0: param1 = obj.param1; break; case 1: param2 = obj.param2; break; default: super.dnCopyField(obj, index); } }and also with minor variations if the class has no fields
access, argNames, argTypes, enhancer, exceptions, methodName, returnType, visitor
Constructor and Description |
---|
CopyField(ClassEnhancer enhancer,
String name,
int access,
Object returnType,
Object[] argTypes,
String[] argNames)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
execute()
Method to add the contents of the class method.
|
static CopyField |
getInstance(ClassEnhancer enhancer) |
close, equals, getAccess, getClassEnhancer, getDescriptor, getMethodAdditionMessage, getName, getNamer, hashCode, initialise, initialise
public CopyField(ClassEnhancer enhancer, String name, int access, Object returnType, Object[] argTypes, String[] argNames)
enhancer
- ClassEnhancername
- Name of methodaccess
- Access typereturnType
- Return typeargTypes
- Argument typesargNames
- Argument namespublic static CopyField getInstance(ClassEnhancer enhancer)
public void execute()
execute
in class ClassMethod
Copyright © 2019. All rights reserved.