Package org.eclipse.jdt.core.dom

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


      return null;
    }
    return Generics.asT(annotation);
  }
  protected <T extends Annotation> T annotation(SingleVariableDeclaration declaration, Class<T> requiredType) {
    Annotation annotation = annotation(declaration);
    if (annotation == null) {
      return null;
    }
    if (!requiredType.isAssignableFrom(annotation.getClass())) {
      return null;
    }
    return Generics.asT(annotation);
  }
View Full Code Here


    }
  }

  private void removeAnnotation(
      ICompilationUnit compilationUnit, BodyDeclaration declaration) throws JavaModelException, MalformedTreeException, BadLocationException {
    Annotation annotation =
      ASTTools.annotation(declaration, getAnnotationUnqualifiedName());
    if (annotation == null) {
      return;
    }
    AstUtils.rewriteReplace(compilationUnit, annotation, null);
View Full Code Here

    AstUtils.rewriteReplace(compilationUnit, annotation, null);
  }

  private void removeAnnotation(
      ICompilationUnit compilationUnit, SingleVariableDeclaration declaration) throws JavaModelException, MalformedTreeException, BadLocationException {
    Annotation annotation =
      ASTTools.annotation(declaration, getAnnotationUnqualifiedName());
    if (annotation == null) {
      return;
    }
    AstUtils.rewriteReplace(compilationUnit, annotation, null);
View Full Code Here

  public void modify(Object object, Object value) {
    if (!(object instanceof AbstractNode)) {
      return;
    }
    AbstractNode node = (AbstractNode) object;
    Annotation annotation = annotation(node);
    if annotation != null &&
            !(annotation.isSingleMemberAnnotation() ||
              annotation.isMarkerAnnotation()          )) {
      return;
    }
   
    try {
      if (value == null || isEmptyString(value)) {
View Full Code Here

    /**
   * @param value - an Object
   */
  public void modify(Object object, Object value) {
    AbstractNode node = (AbstractNode)object;
    Annotation annotation = annotation(node);
    if (annotation != null && !annotation.isNormalAnnotation()) {
      return;
    }
       
        // get existing members as map (if any), and update
        NormalAnnotation normalAnnotation = (NormalAnnotation)annotation;
View Full Code Here

    List list = (List) bodyDeclaration.getStructuralProperty(bodyDeclaration.getModifiersProperty());
    list.remove(annotation);
  }
 
  public static void removeAnnotationElement(BodyDeclaration bodyDeclaration, String annotationName, String elementName) {
    Annotation annotation = annotation(bodyDeclaration, annotationName);
    removeAnnotationElement(bodyDeclaration, annotation, elementName);
  }
View Full Code Here

    }
    return null;
  }

  public static boolean containsAnnotationElement(BodyDeclaration bodyDeclaration, String annotationName, String elementName) {
    Annotation annotation = annotation(bodyDeclaration, annotationName);
    if (elementName.equals("value") && annotation.isSingleMemberAnnotation()) {
      return ((SingleMemberAnnotation) annotation).getValue() != null;
    }
    return memberValuePair(annotation, elementName) != null;
  }
View Full Code Here

   *         (possibly with a value of <tt>null</tt> if there is no such member), or
   *         a simple <tt>null</tt> if there is no annotation.
   */
  public Object evaluate(Object object) {
    AbstractNode node = (AbstractNode)object;
    Annotation annotation = annotation(node);
    if (annotation == null) {
      return null;
    }
    LinkedHashMap<String, Object> elementValues = memberValuesOf(object, annotation);
    return elementValues;
View Full Code Here

  /**
   * @param value - a LinkedHashMap<String,Object>.
   */
  public void modify(Object object, Object value) {
    AbstractNode node = (AbstractNode)object;
    Annotation annotation = annotation(node);
    if (annotation != null && !annotation.isNormalAnnotation()) {
      return;
    }
    LinkedHashMap<String, Object> elementValues = Generics.asT(value);
   
    try {
View Full Code Here

    protected void processModifiersOfFieldDeclaration( FieldDeclaration fieldDeclaration,
                                                       FieldMetadata fieldMetadata ) {
        List<IExtendedModifier> extendedModifiers = fieldDeclaration.modifiers();
        for (IExtendedModifier extendedModifier : extendedModifiers) {
            if (extendedModifier.isAnnotation()) {
                Annotation annotation = (Annotation)extendedModifier;
                fieldMetadata.getAnnotations().add(createAnnotationMetadataFor(annotation));

            } else {
                Modifier modifier = (Modifier)extendedModifier;
                ModifierMetadata modifierMetadata = new ModifierMetadata(modifier.getKeyword().toString());
View Full Code Here

TOP

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

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.