public static void genMethodDeclaration(String destTypeName, IMethod method, int flags, String bodyContent, IImportsStructure imports, StringBuffer buf) throws CoreException { IType parentType= method.getDeclaringType(); String methodName= method.getElementName(); String[] paramTypes= method.getParameterTypes(); String[] paramNames= suggestArgumentNames(parentType.getJavaProject(), method.getParameterNames());  String[] excTypes= method.getExceptionTypes();  boolean isConstructor= method.isConstructor(); String retTypeSig= isConstructor ? null : method.getReturnType();  int lastParam= paramTypes.length -1;  if (Flags.isPublic(flags) || (parentType.isInterface() && bodyContent != null)) { buf.append("public "); } else if (Flags.isProtected(flags)) { buf.append("protected "); } else if (Flags.isPrivate(flags)) { buf.append("private "); } if (Flags.isSynchronized(flags)) { buf.append("synchronized "); } if (Flags.isVolatile(flags)) { buf.append("volatile "); } if (Flags.isStrictfp(flags)) { buf.append("strictfp "); } if (Flags.isStatic(flags)) { buf.append("static "); }  if (isConstructor) { buf.append(destTypeName); } else { String retTypeFrm; if (!isPrimitiveType(retTypeSig)) { retTypeFrm= resolveAndAdd(retTypeSig, parentType, imports); } else { retTypeFrm= Signature.toString(retTypeSig); } buf.append(retTypeFrm); buf.append(' '); buf.append(methodName); } buf.append('('); for (int i= 0; i <= lastParam; i++) { String paramTypeSig= paramTypes[i]; String paramTypeFrm;  if (!isPrimitiveType(paramTypeSig)) { paramTypeFrm= resolveAndAdd(paramTypeSig, parentType, imports); } else { paramTypeFrm= Signature.toString(paramTypeSig); } buf.append(paramTypeFrm); buf.append(' '); buf.append(paramNames[i]); if (i < lastParam) { buf.append(", "); } } buf.append(')');  int lastExc= excTypes.length - 1; if (lastExc >= 0) { buf.append(" throws "); for (int i= 0; i <= lastExc; i++) { String excTypeSig= excTypes[i]; String excTypeFrm= resolveAndAdd(excTypeSig, parentType, imports); buf.append(excTypeFrm); if (i < lastExc) { buf.append(", "); } } } if (bodyContent == null) { buf.append(";\n\n"); } else { buf.append(" {\n\t"); if ((bodyContent != null) && (bodyContent.length() > 0)) { buf.append(bodyContent); buf.append('\n'); } buf.append("}\n"); }
public static void genMethodDeclaration(String destTypeName, IMethod method, String bodyContent, IImportsStructure imports, StringBuffer buf) throws CoreException { genMethodDeclaration(destTypeName, method, method.getFlags(), bodyContent, imports, buf);
	public static void genMethodDeclaration(String destTypeName, IMethod method, int flags, String bodyContent, IImportsStructure imports, StringBuffer buf) throws CoreException {		IType parentType= method.getDeclaringType();			String methodName= method.getElementName();		String[] paramTypes= method.getParameterTypes();		String[] paramNames= suggestArgumentNames(parentType.getJavaProject(), method.getParameterNames());		String[] excTypes= method.getExceptionTypes();		boolean isConstructor= method.isConstructor();		String retTypeSig= isConstructor ? null : method.getReturnType();				int lastParam= paramTypes.length -1;				if (Flags.isPublic(flags) || (parentType.isInterface() && bodyContent != null)) {			buf.append("public "); //$NON-NLS-1$		} else if (Flags.isProtected(flags)) {			buf.append("protected "); //$NON-NLS-1$		} else if (Flags.isPrivate(flags)) {			buf.append("private "); //$NON-NLS-1$		}		if (Flags.isSynchronized(flags)) {			buf.append("synchronized "); //$NON-NLS-1$		}				if (Flags.isVolatile(flags)) {			buf.append("volatile "); //$NON-NLS-1$		}		if (Flags.isStrictfp(flags)) {			buf.append("strictfp "); //$NON-NLS-1$		}		if (Flags.isStatic(flags)) {			buf.append("static "); //$NON-NLS-1$		}							if (isConstructor) {			buf.append(destTypeName);		} else {			String retTypeFrm;			if (!isPrimitiveType(retTypeSig)) {				retTypeFrm= resolveAndAdd(retTypeSig, parentType, imports);			} else {				retTypeFrm= Signature.toString(retTypeSig);			}			buf.append(retTypeFrm);			buf.append(' ');			buf.append(methodName);		}		buf.append('(');		for (int i= 0; i <= lastParam; i++) {			String paramTypeSig= paramTypes[i];			String paramTypeFrm;						if (!isPrimitiveType(paramTypeSig)) {				paramTypeFrm= resolveAndAdd(paramTypeSig, parentType, imports);			} else {				paramTypeFrm= Signature.toString(paramTypeSig);			}			buf.append(paramTypeFrm);			buf.append(' ');			buf.append(paramNames[i]);			if (i < lastParam) {				buf.append(", "); //$NON-NLS-1$			}		}		buf.append(')');				int lastExc= excTypes.length - 1;		if (lastExc >= 0) {			buf.append(" throws "); //$NON-NLS-1$			for (int i= 0; i <= lastExc; i++) {				String excTypeSig= excTypes[i];				String excTypeFrm= resolveAndAdd(excTypeSig, parentType, imports);				buf.append(excTypeFrm);				if (i < lastExc) {					buf.append(", "); //$NON-NLS-1$				}			}		}		if (bodyContent == null) {			buf.append(";\n\n"); //$NON-NLS-1$		} else {			buf.append(" {\n\t"); //$NON-NLS-1$			if ((bodyContent != null) && (bodyContent.length() > 0)) {				buf.append(bodyContent);				buf.append('\n');			}			buf.append("}\n");			 //$NON-NLS-1$		}	}