Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2000, 2008 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at Contributors: IBM Corporation - initial API and implementation /
 package org.eclipse.jdt.internal.core;
 import java.util.List;

This operation creates an instance method.

Required Attributes:

  • Containing type
  • The source code for the method. No verification of the source is performed.
 public class CreateMethodOperation extends CreateTypeMemberOperation {
 	protected String[] parameterTypes;

When executed, this operation will create a method in the given type with the specified source.
 public CreateMethodOperation(IType parentElementString sourceboolean force) {
Returns the type signatures of the parameter types of the current MethodDeclaration
 	if (this. == null) {
 		if (this. != null) {
 			MethodDeclaration methodDeclaration = (MethodDeclarationthis.;
 			List parameters = methodDeclaration.parameters();
 			int size = parameters.size();
 			this. = new String[size];
 			Iterator iterator = parameters.iterator();
 			// convert the AST types to signatures
 			for (int i = 0; i < sizei++) {
 				String typeSig = Util.getSignature(parameter.getType());
 				int extraDimensions = parameter.getExtraDimensions();
 				if (methodDeclaration.isVarargs() && i == size-1)
 				this.[i] = Signature.createArraySignature(typeSigextraDimensions);
 	return this.;
 	ASTNode node = super.generateElementAST(rewritercu);
 	return node;
 	String name = getASTNodeName();
 	return getType().getMethod(nametypes);
 private String getASTNodeName() {
 protected SimpleName rename(ASTNode nodeSimpleName newName) {
	SimpleName oldName = method.getName();
	return oldName;
	if (this. != null) {
		IType type = getType();
		String name;
			name = type.getElementName();
			name = getASTNodeName();
		if (type.getMethod(nametypes).exists()) {
			return new JavaModelStatus(
New to GrepCode? Check out our FAQ X