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

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


   * @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

   * @return true if found
   */
  private static boolean handleAfterReturningAnnotation(RuntimeAnnos runtimeAnnotations, AjAttributeMethodStruct struct,
      ResolvedPointcutDefinition preResolvedPointcut, BcelMethod owningMethod)
      throws ReturningFormalNotDeclaredInAdviceSignatureException {
    AnnotationGen after = getAnnotation(runtimeAnnotations, AjcMemberMaker.AFTERRETURNING_ANNOTATION);
    if (after != null) {
      NameValuePair annValue = getAnnotationElement(after, VALUE);
      NameValuePair annPointcut = getAnnotationElement(after, POINTCUT);
      NameValuePair annReturned = getAnnotationElement(after, RETURNING);

View Full Code Here

  public boolean hasAnnotation(UnresolvedType ofType) {
    // Due to re-entrancy we may be in the middle of unpacking the annotations already... in which case use this slow
    // alternative until the stack unwinds itself
    if (isUnpackingAnnotations()) {
      AnnotationGen annos[] = javaClass.getAnnotations();
      if (annos == null || annos.length == 0) {
        return false;
      } else {
        String lookingForSignature = ofType.getSignature();
        for (int a = 0; a < annos.length; a++) {
          AnnotationGen annotation = annos[a];
          if (lookingForSignature.equals(annotation.getTypeSignature())) {
            return true;
          }
        }
      }
      return false;
View Full Code Here

      throw new BCException("Re-entered weaver instance whilst unpacking annotations on " + this.className);
    }
    if (annotationTypes == null) {
      try {
        bitflag |= ANNOTATION_UNPACK_IN_PROGRESS;
        AnnotationGen annos[] = javaClass.getAnnotations();
        if (annos == null || annos.length == 0) {
          annotationTypes = ResolvedType.NONE;
          annotations = AnnotationAJ.EMPTY_ARRAY;
        } else {
          World w = getResolvedTypeX().getWorld();
          annotationTypes = new ResolvedType[annos.length];
          annotations = new AnnotationAJ[annos.length];
          for (int i = 0; i < annos.length; i++) {
            AnnotationGen annotation = annos[i];
            String typeSignature = annotation.getTypeSignature();
            ResolvedType rType = w.resolve(UnresolvedType.forSignature(typeSignature));
            if (rType == null) {
              throw new RuntimeException("Whilst unpacking annotations on '" + getResolvedTypeX().getName()
                  + "', failed to resolve type '" + typeSignature + "'");
            }
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

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.