Package org.eclipse.jdt.core.dom

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


    updateInterfacesOfAsync(javaProject, serviceRoot, serviceType);
    // change methods, fields and inner classes
    {
      List<BodyDeclaration> bodyDeclarations = DomGenerics.bodyDeclarations(serviceType);
      for (Iterator<BodyDeclaration> I = bodyDeclarations.iterator(); I.hasNext();) {
        BodyDeclaration bodyDeclaration = I.next();
        if (bodyDeclaration instanceof MethodDeclaration) {
          MethodDeclaration methodDeclaration = (MethodDeclaration) bodyDeclaration;
          // make return type void
          Type returnType;
          {
View Full Code Here


   }

   @SuppressWarnings("unchecked")
   private void convertTo(final AnnotationType type)
   {
      BodyDeclaration node = (BodyDeclaration) annotation.getParent();
      String value = this.getLiteralValue();

      for (Object o : node.modifiers())
      {
         if (o.equals(annotation))
         {
            node.modifiers().remove(annotation);
            Annotation<O> na = new AnnotationImpl<O, T>(parent, type);
            na.setName(getName());
            annotation = (org.eclipse.jdt.core.dom.Annotation) na.getInternal();
            node.modifiers().add(annotation);
            break;
         }
      }

      if (!AnnotationType.MARKER.equals(type) && (value != null))
View Full Code Here

   }

   @SuppressWarnings("unchecked")
   private void convertTo(final AnnotationType type)
   {
      BodyDeclaration node = (BodyDeclaration) annotation.getParent();
      String value = this.getLiteralValue();

      for (Object o : node.modifiers())
      {
         if (o.equals(annotation))
         {
            node.modifiers().remove(annotation);
            Annotation<O> na = new AnnotationImpl<O, T>(parent, type);
            na.setName(getName());
            annotation = (org.eclipse.jdt.core.dom.Annotation) na.getInternal();
            node.modifiers().add(annotation);
            break;
         }
      }

      if (!AnnotationType.MARKER.equals(type) && (value != null))
View Full Code Here

   }

   @SuppressWarnings("unchecked")
   private void convertTo(final AnnotationType type)
   {
      BodyDeclaration node = (BodyDeclaration) annotation.getParent();
      String value = this.getLiteralValue();

      for (Object o : node.modifiers())
      {
         if (o.equals(annotation))
         {
            node.modifiers().remove(annotation);
            Annotation<O> na = new AnnotationImpl<O, T>(parent, type);
            na.setName(getName());
            annotation = (org.eclipse.jdt.core.dom.Annotation) na.getInternal();
            node.modifiers().add(annotation);
            break;
         }
      }

      if (!AnnotationType.MARKER.equals(type) && (value != null))
View Full Code Here

        return true;
      }
      public boolean visit(AnnotationTypeDeclaration annotationTypeDeclaration) {
        List bodyDeclarations = annotationTypeDeclaration.bodyDeclarations();
        for (Iterator iter = bodyDeclarations.iterator(); iter.hasNext();) {
          BodyDeclaration bodyDeclaration = (BodyDeclaration) iter.next();
          bodyDeclaration.setProperty(CompilationUnitSorter.RELATIVE_ORDER, new Integer(bodyDeclaration.getStartPosition()));
          annotationTypeDeclaration.setProperty(CONTAINS_MALFORMED_NODES, Boolean.valueOf(isMalformed(bodyDeclaration)));
        }
        return true;
      }

      public boolean visit(AnonymousClassDeclaration anonymousClassDeclaration) {
        List bodyDeclarations = anonymousClassDeclaration.bodyDeclarations();
        for (Iterator iter = bodyDeclarations.iterator(); iter.hasNext();) {
          BodyDeclaration bodyDeclaration = (BodyDeclaration) iter.next();
          bodyDeclaration.setProperty(CompilationUnitSorter.RELATIVE_ORDER, new Integer(bodyDeclaration.getStartPosition()));
          anonymousClassDeclaration.setProperty(CONTAINS_MALFORMED_NODES, Boolean.valueOf(isMalformed(bodyDeclaration)));
        }
        return true;
      }

      public boolean visit(TypeDeclaration typeDeclaration) {
        List bodyDeclarations = typeDeclaration.bodyDeclarations();
        for (Iterator iter = bodyDeclarations.iterator(); iter.hasNext();) {
          BodyDeclaration bodyDeclaration = (BodyDeclaration) iter.next();
          bodyDeclaration.setProperty(CompilationUnitSorter.RELATIVE_ORDER, new Integer(bodyDeclaration.getStartPosition()));
          typeDeclaration.setProperty(CONTAINS_MALFORMED_NODES, Boolean.valueOf(isMalformed(bodyDeclaration)));
        }
        return true;
      }

      public boolean visit(EnumDeclaration enumDeclaration) {
        List bodyDeclarations = enumDeclaration.bodyDeclarations();
        for (Iterator iter = bodyDeclarations.iterator(); iter.hasNext();) {
          BodyDeclaration bodyDeclaration = (BodyDeclaration) iter.next();
          bodyDeclaration.setProperty(CompilationUnitSorter.RELATIVE_ORDER, new Integer(bodyDeclaration.getStartPosition()));
          enumDeclaration.setProperty(CONTAINS_MALFORMED_NODES, Boolean.valueOf(isMalformed(bodyDeclaration)));
        }
        List enumConstants = enumDeclaration.enumConstants();
        for (Iterator iter = enumConstants.iterator(); iter.hasNext();) {
          EnumConstantDeclaration enumConstantDeclaration = (EnumConstantDeclaration) iter.next();
View Full Code Here

   public <NESTED_TYPE extends JavaSource<?>> NESTED_TYPE addNestedType(NESTED_TYPE type)
   {
      if (type instanceof AbstractJavaSource)
      {
         List<Object> bodyDeclarations = getBodyDeclaration().bodyDeclarations();
         BodyDeclaration nestedBody = ((AbstractJavaSource<?>) type).body;
         bodyDeclarations.add(ASTNode.copySubtree(unit.getAST(), nestedBody));
      }
      else
      {
         throw new IllegalArgumentException("type must be an AbstractJavaSource instance");
View Full Code Here

   @Override
   public O removeNestedType(JavaSource<?> type)
   {
      if (type instanceof AbstractJavaSource)
      {
         BodyDeclaration bodyDeclaration = ((AbstractJavaSource<?>) type).body;
         List<Object> bodyDeclarations = getBodyDeclaration().bodyDeclarations();
         bodyDeclarations.remove(bodyDeclaration);
      }
      return (O) this;
   }
View Full Code Here

   @Override
   public Body removeNestedType(JavaSource<?> type)
   {
      if (type instanceof AbstractJavaSource)
      {
         BodyDeclaration bodyDeclaration = ((AbstractJavaSource<?>) type).body;
         List<Object> bodyDeclarations = getBody().bodyDeclarations();
         bodyDeclarations.remove(bodyDeclaration);
      }
      return this;
   }
View Full Code Here

         throw new IllegalArgumentException("Enum constants body allow only classes to be added ");
      }
      if (type instanceof AbstractJavaSource)
      {
         List<Object> bodyDeclarations = getBody().bodyDeclarations();
         BodyDeclaration nestedBody = ((AbstractJavaSource<?>) type).body;
         bodyDeclarations.add(ASTNode.copySubtree(getBody().getAST(), nestedBody));
      }
      else
      {
         throw new IllegalArgumentException("type must be an AbstractJavaSource instance");
View Full Code Here

   }

   @SuppressWarnings("unchecked")
   private void convertTo(final AnnotationType type)
   {
      BodyDeclaration node = (BodyDeclaration) annotation.getParent();
      String value = this.getLiteralValue();

      for (Object o : node.modifiers())
      {
         if (o.equals(annotation))
         {
            node.modifiers().remove(annotation);
            Annotation<O> na = new AnnotationImpl<O, T>(parent, type);
            na.setName(getName());
            annotation = (org.eclipse.jdt.core.dom.Annotation) na.getInternal();
            node.modifiers().add(annotation);
            break;
         }
      }

      if (!AnnotationType.MARKER.equals(type) && (value != null))
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.dom.BodyDeclaration

Copyright © 2018 www.massapicom. 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.