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 fieldsaccess, 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, initialisepublic 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 ClassMethodCopyright © 2017. All rights reserved.