}
public MethodFab addMethod(int modifiers, MethodSignature ms, String body)
{
if (_methods.get(ms) != null)
throw new ApplicationRuntimeException(ServiceMessages.duplicateMethodInClass(ms, this));
CtClass ctReturnType = convertClass(ms.getReturnType());
CtClass[] ctParameters = convertClasses(ms.getParameterTypes());
CtClass[] ctExceptions = convertClasses(ms.getExceptionTypes());
CtMethod method = new CtMethod(ctReturnType, ms.getName(), ctParameters, getCtClass());
try
{
method.setModifiers(modifiers);
method.setBody(body);
method.setExceptionTypes(ctExceptions);
getCtClass().addMethod(method);
}
catch (Exception ex)
{
throw new ApplicationRuntimeException(ServiceMessages.unableToAddMethod(
ms,
getCtClass(),
ex), ex);
}