Examples of TypeParameter


Examples of org.eclipse.jdt.core.dom.TypeParameter

   private org.eclipse.jdt.core.dom.Type parseTypeBound(String bound)
   {
      String stub = "public class Stub<T extends " + bound + "> {}";
      JavaClassSource temp = Roaster.parse(JavaClassSource.class, stub);
      TypeParameter v = (TypeParameter) temp.getTypeVariables().get(0).getInternal();
      return (org.eclipse.jdt.core.dom.Type) v.typeBounds().get(0);
   }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.TypeParameter

   @Override
   public TypeVariableSource<O> addTypeVariable()
   {
      TypeDeclaration type = (TypeDeclaration) body;
      TypeParameter tp2 = unit.getAST().newTypeParameter();
      type.typeParameters().add(tp2);
      return new TypeVariableImpl<O>((O) this, tp2);
   }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.TypeParameter

   @SuppressWarnings("unchecked")
   @Override
   public TypeVariableSource<O> addTypeVariable()
   {
      TypeParameter tp2 = method.getAST().newTypeParameter();
      method.typeParameters().add(tp2);
      return new TypeVariableImpl<O>(parent, tp2);
   }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.TypeParameter

   @Override
   public TypeVariableSource<O> addTypeVariable()
   {
      TypeDeclaration type = (TypeDeclaration) body;
      TypeParameter tp2 = unit.getAST().newTypeParameter();
      type.typeParameters().add(tp2);
      return new TypeVariableImpl<O>((O) this, tp2);
   }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.TypeParameter

   @SuppressWarnings("unchecked")
   @Override
   public TypeVariableSource<O> addTypeVariable()
   {
      TypeParameter tp2 = method.getAST().newTypeParameter();
      method.typeParameters().add(tp2);
      return new TypeVariableImpl<O>(parent, tp2);
   }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.TypeParameter

          .getParameters();
      for (TemplateParameter templateParameter : templateParameters) {
        Classifier classifier = (Classifier) templateParameter
            .getOwnedParameteredElement();
        String typeName = classifier.getLabel();
        TypeParameter typeParameter = ast.newTypeParameter();
        typeParameter.setName(ast.newSimpleName(typeName));
        td.typeParameters().add(typeParameter);
      }
    }
  }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.TypeParameter

          .getParameters();
      for (TemplateParameter templateParameter : templateParameters) {
        Classifier classifier = (Classifier) templateParameter
            .getOwnedParameteredElement();
        String typeName = classifier.getLabel();
        TypeParameter typeParameter = ast.newTypeParameter();
        typeParameter.setName(ast.newSimpleName(typeName));
        md.typeParameters().add(typeParameter);
      }
    }
  }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.TypeParameter

        "java", "util", "Set" }));
    cu.imports().add(id);

    TypeDeclaration td = ast.newTypeDeclaration();
    td.setName(ast.newSimpleName("Foo"));
    TypeParameter tp = ast.newTypeParameter();
    tp.setName(ast.newSimpleName("X"));
    td.typeParameters().add(tp);
    cu.types().add(td);

    MethodDeclaration md = ast.newMethodDeclaration();
    md.modifiers().add(ast.newModifier(ModifierKeyword.PUBLIC_KEYWORD));
View Full Code Here

Examples of org.eclipse.jdt.core.dom.TypeParameter

    if (node.getAST().apiLevel() >= JLS3) {
      printModifiers(node.modifiers());
      if (!node.typeParameters().isEmpty()) {
        this.buffer.append("<");//$NON-NLS-1$
        for (Iterator it = node.typeParameters().iterator(); it.hasNext(); ) {
          TypeParameter t = (TypeParameter) it.next();
          t.accept(this);
          if (it.hasNext()) {
            this.buffer.append(",");//$NON-NLS-1$
          }
        }
        this.buffer.append(">");//$NON-NLS-1$
View Full Code Here

Examples of org.eclipse.jdt.core.dom.TypeParameter

    node.getName().accept(this);
    if (node.getAST().apiLevel() >= JLS3) {
      if (!node.typeParameters().isEmpty()) {
        this.buffer.append("<");//$NON-NLS-1$
        for (Iterator it = node.typeParameters().iterator(); it.hasNext(); ) {
          TypeParameter t = (TypeParameter) it.next();
          t.accept(this);
          if (it.hasNext()) {
            this.buffer.append(",");//$NON-NLS-1$
          }
        }
        this.buffer.append(">");//$NON-NLS-1$
      }
    }
    this.buffer.append(" ");//$NON-NLS-1$
    if (node.getAST().apiLevel() == JLS2) {
      if (getSuperclass(node) != null) {
        this.buffer.append("extends ");//$NON-NLS-1$
        getSuperclass(node).accept(this);
        this.buffer.append(" ");//$NON-NLS-1$
      }
      if (!superInterfaces(node).isEmpty()) {
        this.buffer.append(node.isInterface() ? "extends " : "implements ");//$NON-NLS-2$//$NON-NLS-1$
        for (Iterator it = superInterfaces(node).iterator(); it.hasNext(); ) {
          Name n = (Name) it.next();
          n.accept(this);
          if (it.hasNext()) {
            this.buffer.append(", ");//$NON-NLS-1$
          }
        }
        this.buffer.append(" ");//$NON-NLS-1$
      }
    }
    if (node.getAST().apiLevel() >= JLS3) {
      if (node.getSuperclassType() != null) {
        this.buffer.append("extends ");//$NON-NLS-1$
        node.getSuperclassType().accept(this);
        this.buffer.append(" ");//$NON-NLS-1$
      }
      if (!node.superInterfaceTypes().isEmpty()) {
        this.buffer.append(node.isInterface() ? "extends " : "implements ");//$NON-NLS-2$//$NON-NLS-1$
        for (Iterator it = node.superInterfaceTypes().iterator(); it.hasNext(); ) {
          Type t = (Type) it.next();
          t.accept(this);
          if (it.hasNext()) {
            this.buffer.append(", ");//$NON-NLS-1$
          }
        }
        this.buffer.append(" ");//$NON-NLS-1$
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.