Package org.aspectj.apache.bcel.classfile.annotation

Examples of org.aspectj.apache.bcel.classfile.annotation.AnnotationGen


    for (Attribute attr : attributes) {
      if (attr instanceof RuntimeVisAnnos) {
        RuntimeVisAnnos rva = (RuntimeVisAnnos) attr;
        List<AnnotationGen> annos = rva.getAnnotations();
        for (AnnotationGen a : annos) {
          annotationsList.add(new AnnotationGen(a, cpool, false));
        }
      } else if (attr instanceof RuntimeInvisAnnos) {
        RuntimeInvisAnnos ria = (RuntimeInvisAnnos) attr;
        List<AnnotationGen> annos = ria.getAnnotations();
        for (AnnotationGen anno : annos) {
          annotationsList.add(new AnnotationGen(anno, cpool, false));
        }
      } else {
        attributesList.add(attr);
      }
    }
View Full Code Here


    return null;
  }

  private void ensureAnnotationTypesRetrieved() {
    if (annotationTypes == null) {
      AnnotationGen annos[] = field.getAnnotations();
      if (annos.length == 0) {
        annotationTypes = ResolvedType.EMPTY_ARRAY;
        annotations = AnnotationAJ.EMPTY_ARRAY;
      } else {
        int annosCount = annos.length;
        annotationTypes = new ResolvedType[annosCount];
        annotations = new AnnotationAJ[annosCount];
        for (int i = 0; i < annosCount; i++) {
          AnnotationGen anno = annos[i];
          annotations[i] = new BcelAnnotation(anno, world);
          annotationTypes[i] = annotations[i].getType();
        }
      }
    }
View Full Code Here

    newFieldGen.removeAnnotations();
    // List<AnnotationGen> alreadyHas = fg.getAnnotations();
    // if (annotations != null) {
    // fg.removeAnnotations();
    for (AnnotationAJ annotation : annotations) {
      newFieldGen.addAnnotation(new AnnotationGen(((BcelAnnotation) annotation).getBcelAnnotation(), cpool, true));
    }
    // for (int i = 0; i < annotations.length; i++) {
    // AnnotationAJ array_element = annotations[i];
    // boolean alreadyHasIt = false;
    // for (AnnotationGen gen : alreadyHas) {
View Full Code Here

      gen.addAttribute(attr);
    }

    if (newAnnotations != null) {
      for (AnnotationAJ element : newAnnotations) {
        gen.addAnnotation(new AnnotationGen(((BcelAnnotation) element).getBcelAnnotation(), gen.getConstantPool(), true));
      }
    }

    if (newParameterAnnotations != null) {
      for (int i = 0; i < newParameterAnnotations.length; i++) {
        AnnotationAJ[] annos = newParameterAnnotations[i];
        for (int j = 0; j < annos.length; j++) {
          gen.addParameterAnnotation(i,
              new AnnotationGen(((BcelAnnotation) annos[j]).getBcelAnnotation(), gen.getConstantPool(), true));
        }
      }
    }

    if (memberView != null && memberView.getAnnotations() != null && memberView.getAnnotations().length != 0) {
      AnnotationAJ[] ans = memberView.getAnnotations();
      for (int i = 0, len = ans.length; i < len; i++) {
        AnnotationGen a = ((BcelAnnotation) ans[i]).getBcelAnnotation();
        gen.addAnnotation(new AnnotationGen(a, gen.getConstantPool(), true));
      }
    }

    if (isSynthetic) {
      if (enclosingClass.getWorld().isInJava5Mode()) {
View Full Code Here

   * @param runtimeAnnotations
   * @param struct
   * @return true if found
   */
  private static boolean handleAspectAnnotation(RuntimeAnnos runtimeAnnotations, AjAttributeStruct struct) {
    AnnotationGen aspect = getAnnotation(runtimeAnnotations, AjcMemberMaker.ASPECT_ANNOTATION);
    if (aspect != null) {
      // semantic check for inheritance (only one level up)
      boolean extendsAspect = false;
      if (!"java.lang.Object".equals(struct.enclosingType.getSuperclass().getName())) {
        if (!struct.enclosingType.getSuperclass().isAbstract() && struct.enclosingType.getSuperclass().isAspect()) {
View Full Code Here

   * @param runtimeAnnotations
   * @param struct
   * @return true if found
   */
  private static boolean handlePrecedenceAnnotation(RuntimeAnnos runtimeAnnotations, AjAttributeStruct struct) {
    AnnotationGen aspect = getAnnotation(runtimeAnnotations, AjcMemberMaker.DECLAREPRECEDENCE_ANNOTATION);
    if (aspect != null) {
      NameValuePair precedence = getAnnotationElement(aspect, VALUE);
      if (precedence != null) {
        String precedencePattern = precedence.getValue().stringifyValue();
        PatternParser parser = new PatternParser(precedencePattern);
View Full Code Here

   */
  private static boolean handleDeclareParentsAnnotation(RuntimeAnnos runtimeAnnotations, AjAttributeFieldStruct struct) {// ,
    // ResolvedPointcutDefinition
    // preResolvedPointcut)
    // {
    AnnotationGen decp = getAnnotation(runtimeAnnotations, AjcMemberMaker.DECLAREPARENTS_ANNOTATION);
    if (decp != null) {
      NameValuePair decpPatternNVP = getAnnotationElement(decp, VALUE);
      String decpPattern = decpPatternNVP.getValue().stringifyValue();
      if (decpPattern != null) {
        TypePattern typePattern = parseTypePattern(decpPattern, struct);
View Full Code Here

   * @param runtimeAnnotations
   * @param struct
   * @return true if found
   */
  private static boolean handleDeclareMixinAnnotation(RuntimeAnnos runtimeAnnotations, AjAttributeMethodStruct struct) {
    AnnotationGen declareMixinAnnotation = getAnnotation(runtimeAnnotations, AjcMemberMaker.DECLAREMIXIN_ANNOTATION);
    if (declareMixinAnnotation == null) {
      // No annotation found
      return false;
    }

View Full Code Here

   * @param struct
   * @return true if found
   */
  private static boolean handleBeforeAnnotation(RuntimeAnnos runtimeAnnotations, AjAttributeMethodStruct struct,
      ResolvedPointcutDefinition preResolvedPointcut) {
    AnnotationGen before = getAnnotation(runtimeAnnotations, AjcMemberMaker.BEFORE_ANNOTATION);
    if (before != null) {
      NameValuePair beforeAdvice = getAnnotationElement(before, VALUE);
      if (beforeAdvice != null) {
        // this/target/args binding
        String argumentNames = getArgNamesValue(before);
View Full Code Here

   * @param struct
   * @return true if found
   */
  private static boolean handleAfterAnnotation(RuntimeAnnos runtimeAnnotations, AjAttributeMethodStruct struct,
      ResolvedPointcutDefinition preResolvedPointcut) {
    AnnotationGen after = getAnnotation(runtimeAnnotations, AjcMemberMaker.AFTER_ANNOTATION);
    if (after != null) {
      NameValuePair afterAdvice = getAnnotationElement(after, VALUE);
      if (afterAdvice != null) {
        // this/target/args binding
        FormalBinding[] bindings = new org.aspectj.weaver.patterns.FormalBinding[0];
View Full Code Here

TOP

Related Classes of org.aspectj.apache.bcel.classfile.annotation.AnnotationGen

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.