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

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


                    // the annotation is already there
                    unusedDecams.remove(decaM);
                    continue; // skip this one...
                  }
                 
                  Annotation a = decaM.getAnnotationX().getBcelAnnotation();
                  AnnotationGen ag = new AnnotationGen(a,clazz.getConstantPoolGen(),true);
                  Method oldMethod = mg.getMethod();
                  MethodGen myGen = new MethodGen(oldMethod,clazz.getClassName(),clazz.getConstantPoolGen());
                  myGen.addAnnotation(ag);
                  Method newMethod = myGen.getMethod();
View Full Code Here


        return isChanged;
  }
 
  private boolean dontAddTwice(DeclareAnnotation decaF, Annotation [] dontAddMeTwice){
    for (int i = 0; i < dontAddMeTwice.length; i++){
      Annotation ann = dontAddMeTwice[i];
      if (ann != null && decaF.getAnnotationX().getTypeName().equals(ann.getTypeName())){
        dontAddMeTwice[i] = null; // incase it really has been added twice!
        return true;
      }
    }
    return false;
View Full Code Here

            }
           
            if(decaF.getAnnotationX().isRuntimeVisible()){ // isAnnotationWithRuntimeRetention(clazz.getJavaClass(world))){
            //if(decaF.getAnnotationTypeX().isAnnotationWithRuntimeRetention(world)){           
              // it should be runtime visible, so put it on the Field
              Annotation a = decaF.getAnnotationX().getBcelAnnotation();
              AnnotationGen ag = new AnnotationGen(a,clazz.getConstantPoolGen(),true);
              FieldGen myGen = new FieldGen(fields[fieldCounter],clazz.getConstantPoolGen());
              myGen.addAnnotation(ag);
              Field newField = myGen.getField();
             
View Full Code Here

    discoveredRetentionPolicy=true;
        retentionPolicy=null; // null means we have no idea
    if (isAnnotation()) {
          Annotation[] annotationsOnThisType = javaClass.getAnnotations();
          for (int i = 0; i < annotationsOnThisType.length; i++) {
              Annotation a = annotationsOnThisType[i];
              if (a.getTypeName().equals(UnresolvedType.AT_RETENTION.getName())) {
                  List values = a.getValues();
                  boolean isRuntime = false;
                  for (Iterator it = values.iterator(); it.hasNext();) {
                        ElementNameValuePair element = (ElementNameValuePair) it.next();
                        ElementValue v = element.getValue();
                        retentionPolicy = v.stringifyValue();
View Full Code Here

    annotationTargetKinds = null; // null means we have no idea or the @Target annotation hasn't been used
    List targetKinds = new ArrayList();
    if (isAnnotation()) {
          Annotation[] annotationsOnThisType = javaClass.getAnnotations();
          for (int i = 0; i < annotationsOnThisType.length; i++) {
              Annotation a = annotationsOnThisType[i];
              if (a.getTypeName().equals(UnresolvedType.AT_TARGET.getName())) {
                  List values = a.getValues();
                  for (Iterator it = values.iterator(); it.hasNext();) {
                        ElementNameValuePair element = (ElementNameValuePair) it.next();
                        ElementValue v = element.getValue();
                        String targetKind = v.stringifyValue();
                        if (targetKind.equals("ANNOTATION_TYPE")) {
View Full Code Here

    return false;
  }
 
  private void ensureAnnotationTypesRetrieved() {
    if (annotationTypes == null) {
        Annotation annos[] = javaClass.getAnnotations();
        annotationTypes = new ResolvedType[annos.length];
        annotations = new AnnotationX[annos.length];
        for (int i = 0; i < annos.length; i++) {
        Annotation annotation = annos[i];
        ResolvedType rtx = getResolvedTypeX().getWorld().resolve(UnresolvedType.forName(annotation.getTypeName()));
        annotationTypes[i] = rtx;
        annotations[i] = new AnnotationX(annotation,getResolvedTypeX().getWorld());
      }
      }
  }
View Full Code Here

            ClassParser cp = new ClassParser(new ByteArrayInputStream(bytes), null);
            JavaClass jc = cp.parse();
            if (!jc.isClass()) {
                return false;
            }
            Annotation anns[] = jc.getAnnotations();
            if (anns.length == 0) {
                return false;
            }
            boolean couldBeAtAspectJStyle = false;
            for (int i = 0; i < anns.length; i++) {
                Annotation ann = anns[i];
                if ("Lorg/aspectj/lang/annotation/Aspect;".equals(ann.getTypeSignature())) {
                    couldBeAtAspectJStyle = true;
                }
            }
           
            if (!couldBeAtAspectJStyle) return false;
View Full Code Here

        annotationsOnRealMember = realMember.getAnnotations();
       
        if (annotationsOnRealMember!=null) {
          for (int i = 0; i < annotationsOnRealMember.length; i++) {
            AnnotationX annotationX = annotationsOnRealMember[i];
            Annotation a = annotationX.getBcelAnnotation();
            AnnotationGen ag = new AnnotationGen(a,weaver.getLazyClassGen().getConstantPoolGen(),true);
            newMethod.addAnnotation(new AnnotationX(ag.getAnnotation(),weaver.getWorld()));
          }
        }
        // the below loop fixes the very special (and very stupid)
View Full Code Here

                    }
                }
                if (annotationsOnRealMember!=null) {
                    for (int i = 0; i < annotationsOnRealMember.length; i++) {
                        AnnotationX annotationX = annotationsOnRealMember[i];
                        Annotation a = annotationX.getBcelAnnotation();
                        AnnotationGen ag = new AnnotationGen(a,weaver.getLazyClassGen().getConstantPoolGen(),true);
                        mg.addAnnotation(new AnnotationX(ag.getAnnotation(),weaver.getWorld()));
                    }
                }
            }
View Full Code Here

          interMethodDispatcher+"' on aspect "+aspectType);
      annotationsOnRealMember = realMember.getAnnotations();
      if (annotationsOnRealMember!=null) {
        for (int i = 0; i < annotationsOnRealMember.length; i++) {
          AnnotationX annotationX = annotationsOnRealMember[i];
          Annotation a = annotationX.getBcelAnnotation();
          AnnotationGen ag = new AnnotationGen(a,weaver.getLazyClassGen().getConstantPoolGen(),true);
          mg.addAnnotation(new AnnotationX(ag.getAnnotation(),weaver.getWorld()));
        }
      }
      // the below loop fixes the very special (and very stupid)
View Full Code Here

TOP

Related Classes of org.aspectj.apache.bcel.classfile.annotation.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.