Package org.eclipse.jdt.core.dom

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


                        normalAnnotationMetadata.setName(JavaMetadataUtil.getName(normalAnnotation.getTypeName()));
                        normalAnnotationMetadata.setNormal(Boolean.TRUE);
                        packageMetadata.getAnnotationMetada().add(normalAnnotationMetadata);
                    }
                    if (object instanceof MarkerAnnotation) {
                        MarkerAnnotation markerAnnotation = (MarkerAnnotation)object;
                        MarkerAnnotationMetadata markerAnnotationMetadata = new MarkerAnnotationMetadata();
                        markerAnnotationMetadata.setName(JavaMetadataUtil.getName(markerAnnotation.getTypeName()));
                        markerAnnotationMetadata.setMarker(Boolean.TRUE);
                        packageMetadata.getAnnotationMetada().add(markerAnnotationMetadata);
                    }
                    if (object instanceof SingleMemberAnnotation) {
                        SingleMemberAnnotation singleMemberAnnotation = (SingleMemberAnnotation)object;
View Full Code Here


        for (IExtendedModifier extendedModifier : modifiers) {
            ModifierMetadata modifierMetadata = new ModifierMetadata();
            if (extendedModifier.isAnnotation()) {
                if (extendedModifier instanceof MarkerAnnotation) {
                    MarkerAnnotation marker = (MarkerAnnotation)extendedModifier;
                    MarkerAnnotationMetadata markerAnnotationMetadata = new MarkerAnnotationMetadata();
                    markerAnnotationMetadata.setName(JavaMetadataUtil.getName(marker.getTypeName()));
                    classMetadata.getAnnotations().add(markerAnnotationMetadata);
                }
            } else {

                Modifier modifier = (Modifier)extendedModifier;
View Full Code Here

                        normalAnnotationMetadata.setName(JavaMetadataUtil.getName(normalAnnotation.getTypeName()));
                        normalAnnotationMetadata.setNormal(Boolean.TRUE);
                        packageMetadata.getAnnotationMetada().add(normalAnnotationMetadata);
                    }
                    if (object instanceof MarkerAnnotation) {
                        MarkerAnnotation markerAnnotation = (MarkerAnnotation)object;
                        MarkerAnnotationMetadata markerAnnotationMetadata = new MarkerAnnotationMetadata();
                        markerAnnotationMetadata.setName(JavaMetadataUtil.getName(markerAnnotation.getTypeName()));
                        markerAnnotationMetadata.setMarker(Boolean.TRUE);
                        packageMetadata.getAnnotationMetada().add(markerAnnotationMetadata);
                    }
                    if (object instanceof SingleMemberAnnotation) {
                        SingleMemberAnnotation singleMemberAnnotation = (SingleMemberAnnotation)object;
View Full Code Here

        for (IExtendedModifier extendedModifier : modifiers) {
            ModifierMetadata modifierMetadata = new ModifierMetadata();
            if (extendedModifier.isAnnotation()) {
                if (extendedModifier instanceof MarkerAnnotation) {
                    MarkerAnnotation marker = (MarkerAnnotation)extendedModifier;
                    MarkerAnnotationMetadata markerAnnotationMetadata = new MarkerAnnotationMetadata();
                    markerAnnotationMetadata.setName(JavaMetadataUtil.getName(marker.getTypeName()));
                    classMetadata.getAnnotations().add(markerAnnotationMetadata);
                }
            } else {

                Modifier modifier = (Modifier)extendedModifier;
View Full Code Here

       
                AstUtils.rewriteReplace(
                    compilationUnit, singleMemberAnnotation.getValue(), replacement);
                return;
            } else {
                MarkerAnnotation replacementAnnotation = ast.newMarkerAnnotation();
                replacementAnnotation.setTypeName(ast.newName(singleMemberAnnotation.getTypeName().getFullyQualifiedName()));
                AstUtils.rewriteReplace(
                    compilationUnit, singleMemberAnnotation, replacementAnnotation);
                return;
            }
        }
        MarkerAnnotation markerAnnotation =
            annotation(declaration, MarkerAnnotation.class);
        if (markerAnnotation != null) {
            AST ast = markerAnnotation.getAST();
            if (value != QualifiedNameValue.DEFAULT_VALUE) {
                SingleMemberAnnotation replacementAnnotation = ast.newSingleMemberAnnotation();
                replacementAnnotation.setTypeName(ast.newName(markerAnnotation.getTypeName().getFullyQualifiedName()));
                Expression memberValueExpression = 
                    value != null? AstUtils.createExpression(
                            ast, value): null;
                replacementAnnotation.setValue(memberValueExpression);
                AstUtils.rewriteReplace(
View Full Code Here

   * Convenience method on AST to create a new MarkerAnnotation with the given annotation name.
   * If annotationName is "Table" this will result in "@Table" in the java source when it is added
   * to a BodyDeclaration.  See addAnnotation(BodyDeclaration, Annotation)
   */
  public static MarkerAnnotation newMarkerAnnotation(AST ast, String annotationName) {
    MarkerAnnotation annotation = ast.newMarkerAnnotation();
    annotation.setTypeName(ast.newSimpleName(annotationName));
    return annotation;
  }
View Full Code Here

  public static void removeAnnotationElement(BodyDeclaration bodyDeclaration, Annotation annotation, String elementName) {
    MemberValuePair valuePairToRemove = memberValuePair(annotation, elementName);
   
    if (valuePairToRemove != null) {
      if (((NormalAnnotation) annotation).values().size() == 1) {
        MarkerAnnotation newAnnotation = newMarkerAnnotation(bodyDeclaration.getAST(), annotation.getTypeName().getFullyQualifiedName());
       
        List list = (List) bodyDeclaration.getStructuralProperty(bodyDeclaration.getModifiersProperty());
        int index = list.indexOf(annotation);
        list.set(index, newAnnotation);           
      }
View Full Code Here

  public static MarkerAnnotation createMarkerAnnotation(AST ast, String annotationName) {
    return createMarkerAnnotation(ast, annotationName, false);
  }

  public static MarkerAnnotation createMarkerAnnotation(AST ast, String annotationName, boolean forceFullyQualified) {
    MarkerAnnotation newMarkerAnnotation = ast.newMarkerAnnotation();
    String name = forceFullyQualified?annotationName:unqualified(annotationName);
    newMarkerAnnotation.setTypeName(ast.newName(name));
    return newMarkerAnnotation;
  }
View Full Code Here

            SingleMemberAnnotation newSingleMemberAnnotation = ast.newSingleMemberAnnotation();
            newSingleMemberAnnotation.setTypeName(ast.newName(name));
            newSingleMemberAnnotation.setValue(AstUtils.createExpression(ast, value));
            return newSingleMemberAnnotation;
        } else {
            MarkerAnnotation newMarkerAnnotation = ast.newMarkerAnnotation();;
            newMarkerAnnotation.setTypeName(ast.newName(name));
            return newMarkerAnnotation;
        }
  }
View Full Code Here

            return AnnotationMetadata.normalAnnotation(JavaMetadataUtil.getName(normalAnnotation.getTypeName()), memberValues);
        }

        if (annotation instanceof MarkerAnnotation) {
            MarkerAnnotation markerAnnotation = (MarkerAnnotation)annotation;
            return AnnotationMetadata.markerAnnotation(JavaMetadataUtil.getName(markerAnnotation.getTypeName()));
        }

        if (annotation instanceof SingleMemberAnnotation) {
            SingleMemberAnnotation singleMemberAnnotation = (SingleMemberAnnotation)annotation;
            return AnnotationMetadata.singleMemberAnnotation(JavaMetadataUtil.getName(singleMemberAnnotation.getTypeName()),
View Full Code Here

TOP

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

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.