Codota Logo
IType.createMethod
Code IndexAdd Codota to your IDE (free)

How to use
createMethod
method
in
org.eclipse.jdt.core.IType

Best Java code snippets using org.eclipse.jdt.core.IType.createMethod (Showing top 6 results out of 315)

  • Common ways to obtain IType
private void myMethod () {
IType i =
  • Codota IconIMethod method;method.getDeclaringType()
  • Codota IconIJavaProject javaProject;String fullyQualifiedName;javaProject.findType(fullyQualifiedName)
  • Codota IconIMember member;member.getDeclaringType()
  • Smart code suggestions by Codota
}
origin: org.eclipse/org.eclipse.jst.j2ee.ejb.annotations.emitter

/**
 * @param createdType
 * @param imports
 * @param monitor2
 */
private void createTypeMembers(IType createdType, ImportsManager imports, SubProgressMonitor monitor2) throws JavaModelException {
  if (fields != null && fields.length() > 0)
    createdType.createField(fields, null, false, this.getMonitor());
  if (methodStub != null && methodStub.length() > 0)
    createdType.createMethod(methodStub, null, false, this.getMonitor());
}
origin: org.eclipse/org.eclipse.jdt.ui

protected void createTypeMembers(IType type, ImportsManager imports, IProgressMonitor monitor) throws CoreException {
  boolean doMain= isCreateMain();
  boolean doConstr= isCreateConstructors();
  boolean doInherited= isCreateInherited();
  createInheritedMethods(type, doConstr, doInherited, imports, new SubProgressMonitor(monitor, 1));
  if (doMain) {
    StringBuffer buf= new StringBuffer();
    final String lineDelim= "\n"; // OK, since content is formatted afterwards //$NON-NLS-1$
    String comment= CodeGeneration.getMethodComment(type.getCompilationUnit(), type.getTypeQualifiedName('.'), "main", new String[] {"args"}, new String[0], Signature.createTypeSignature("void", true), null, lineDelim); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    if (comment != null) {
      buf.append(comment);
      buf.append(lineDelim);
    }
    buf.append("public static void main("); //$NON-NLS-1$
    buf.append(imports.addImport("java.lang.String")); //$NON-NLS-1$
    buf.append("[] args) {"); //$NON-NLS-1$
    buf.append(lineDelim);
    final String content= CodeGeneration.getMethodBodyContent(type.getCompilationUnit(), type.getTypeQualifiedName('.'), "main", false, "", lineDelim); //$NON-NLS-1$ //$NON-NLS-2$
    if (content != null && content.length() != 0)
      buf.append(content);
    buf.append(lineDelim);
    buf.append("}"); //$NON-NLS-1$
    type.createMethod(buf.toString(), null, false, null);
  }
  
  if (monitor != null) {
    monitor.done();
  }    
}

origin: org.eclipse/org.eclipse.ajdt.ui

buf.append(lineDelim);
buf.append("}"); //$NON-NLS-1$
type.createMethod(buf.toString(), null, false, null);
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

buf.append(lineDelim);
buf.append("}"); //$NON-NLS-1$
type.createMethod(buf.toString(), null, false, null);
origin: org.eclipse.jdt/org.eclipse.jdt.ui

buf.append(lineDelim);
buf.append("}"); //$NON-NLS-1$
type.createMethod(buf.toString(), null, false, null);
origin: org.eclipse/org.eclipse.ajdt.ui

  str = "protected " + str; //$NON-NLS-1$
type.createMethod(str, null, false, null);
org.eclipse.jdt.coreITypecreateMethod

Javadoc

Creates and returns a method or constructor in this type with the given contents.

Optionally, the new element can be positioned before the specified sibling. If no sibling is specified, the element will be appended to this type.

It is possible that a method with the same signature already exists in this type. The value of the force parameter affects the resolution of such a conflict:

  • true - in this case the method is created with the new contents
  • false - in this case a JavaModelException is thrown

Popular methods of IType

  • getFullyQualifiedName
    Returns the fully qualified name of this type, including qualification for any containing types and
  • getElementName
    Returns the simple name of this type, unqualified by package or enclosing type. This is a handle-onl
  • getMethods
    Returns the methods and constructors declared by this type. For binary types, this may include the s
  • getFlags
  • getPackageFragment
    Returns the package fragment in which this element is defined. This is a handle-only method.
  • getCompilationUnit
  • newSupertypeHierarchy
    Creates and returns a type hierarchy for this type containing this type and all of its supertypes, c
  • exists
  • getJavaProject
  • isInterface
    Returns whether this type represents an interface. Note that an interface can also be an annotation
  • getDeclaringType
  • getMethod
    Returns the method with the specified name and parameter types in this type (for example, "foo", {"I
  • getDeclaringType,
  • getMethod,
  • getParent,
  • isClass,
  • getSourceRange,
  • newTypeHierarchy,
  • isAnonymous,
  • isBinary,
  • getResource,
  • getTypeParameters

Popular in Java

  • Start an intent from android
  • putExtra (Intent)
  • requestLocationUpdates (LocationManager)
  • getSharedPreferences (Context)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • FileOutputStream (java.io)
    A file output stream is an output stream for writing data to aFile or to a FileDescriptor. Whether
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • DecimalFormat (java.text)
    DecimalFormat is a concrete subclass ofNumberFormat that formats decimal numbers. It has a variety o
  • ArrayList (java.util)
    Resizable-array implementation of the List interface. Implements all optional list operations, and p
  • Table (org.hibernate.mapping)
    A relational table
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now