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

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


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


   * @return true if found
   */
  private static boolean handleAfterThrowingAnnotation(RuntimeAnnos runtimeAnnotations, AjAttributeMethodStruct struct,
      ResolvedPointcutDefinition preResolvedPointcut, BcelMethod owningMethod)
      throws ThrownFormalNotDeclaredInAdviceSignatureException {
    AnnotationGen after = getAnnotation(runtimeAnnotations, AjcMemberMaker.AFTERTHROWING_ANNOTATION);
    if (after != null) {
      NameValuePair annValue = getAnnotationElement(after, VALUE);
      NameValuePair annPointcut = getAnnotationElement(after, POINTCUT);
      NameValuePair annThrown = getAnnotationElement(after, THROWING);

View Full Code Here

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

   * @param runtimeAnnotations
   * @param struct
   * @return true if a pointcut was handled
   */
  private static boolean handlePointcutAnnotation(RuntimeAnnos runtimeAnnotations, AjAttributeMethodStruct struct) {
    AnnotationGen pointcut = getAnnotation(runtimeAnnotations, AjcMemberMaker.POINTCUT_ANNOTATION);
    if (pointcut == null) {
      return false;
    }
    NameValuePair pointcutExpr = getAnnotationElement(pointcut, VALUE);

View Full Code Here

   * @param struct
   * @return true if found
   */
  private static boolean handleDeclareErrorOrWarningAnnotation(AsmManager model, RuntimeAnnos runtimeAnnotations,
      AjAttributeFieldStruct struct) {
    AnnotationGen error = getAnnotation(runtimeAnnotations, AjcMemberMaker.DECLAREERROR_ANNOTATION);
    boolean hasError = false;
    if (error != null) {
      NameValuePair declareError = getAnnotationElement(error, VALUE);
      if (declareError != null) {
        if (!STRING_DESC.equals(struct.field.getSignature()) || struct.field.getConstantValue() == null) {
          reportError("@DeclareError used on a non String constant field", struct);
          return false;
        }
        Pointcut pc = parsePointcut(declareError.getValue().stringifyValue(), struct, false);
        if (pc == null) {
          hasError = false;// cannot parse pointcut
        } else {
          DeclareErrorOrWarning deow = new DeclareErrorOrWarning(true, pc, struct.field.getConstantValue().toString());
          setDeclareErrorOrWarningLocation(model, deow, struct);
          struct.ajAttributes.add(new AjAttribute.DeclareAttribute(deow));
          hasError = true;
        }
      }
    }
    AnnotationGen warning = getAnnotation(runtimeAnnotations, AjcMemberMaker.DECLAREWARNING_ANNOTATION);
    boolean hasWarning = false;
    if (warning != null) {
      NameValuePair declareWarning = getAnnotationElement(warning, VALUE);
      if (declareWarning != null) {
        if (!STRING_DESC.equals(struct.field.getSignature()) || struct.field.getConstantValue() == null) {
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

   * @return true if found
   */
  private static boolean handleAfterThrowingAnnotation(RuntimeAnnos runtimeAnnotations, AjAttributeMethodStruct struct,
      ResolvedPointcutDefinition preResolvedPointcut, BcelMethod owningMethod)
      throws ThrownFormalNotDeclaredInAdviceSignatureException {
    AnnotationGen after = getAnnotation(runtimeAnnotations, AjcMemberMaker.AFTERTHROWING_ANNOTATION);
    if (after != null) {
      NameValuePair annValue = getAnnotationElement(after, VALUE);
      NameValuePair annPointcut = getAnnotationElement(after, POINTCUT);
      NameValuePair annThrown = getAnnotationElement(after, THROWING);

View Full Code Here

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

   * @param runtimeAnnotations
   * @param struct
   * @return true if a pointcut was handled
   */
  private static boolean handlePointcutAnnotation(RuntimeAnnos runtimeAnnotations, AjAttributeMethodStruct struct) {
    AnnotationGen pointcut = getAnnotation(runtimeAnnotations, AjcMemberMaker.POINTCUT_ANNOTATION);
    if (pointcut == null) {
      return false;
    }
    NameValuePair pointcutExpr = getAnnotationElement(pointcut, VALUE);

View Full Code Here

   * @param struct
   * @return true if found
   */
  private static boolean handleDeclareErrorOrWarningAnnotation(AsmManager model, RuntimeAnnos runtimeAnnotations,
      AjAttributeFieldStruct struct) {
    AnnotationGen error = getAnnotation(runtimeAnnotations, AjcMemberMaker.DECLAREERROR_ANNOTATION);
    boolean hasError = false;
    if (error != null) {
      NameValuePair declareError = getAnnotationElement(error, VALUE);
      if (declareError != null) {
        if (!STRING_DESC.equals(struct.field.getSignature()) || struct.field.getConstantValue() == null) {
          reportError("@DeclareError used on a non String constant field", struct);
          return false;
        }
        Pointcut pc = parsePointcut(declareError.getValue().stringifyValue(), struct, false);
        if (pc == null) {
          hasError = false;// cannot parse pointcut
        } else {
          DeclareErrorOrWarning deow = new DeclareErrorOrWarning(true, pc, struct.field.getConstantValue().toString());
          setDeclareErrorOrWarningLocation(model, deow, struct);
          struct.ajAttributes.add(new AjAttribute.DeclareAttribute(deow));
          hasError = true;
        }
      }
    }
    AnnotationGen warning = getAnnotation(runtimeAnnotations, AjcMemberMaker.DECLAREWARNING_ANNOTATION);
    boolean hasWarning = false;
    if (warning != null) {
      NameValuePair declareWarning = getAnnotationElement(warning, VALUE);
      if (declareWarning != null) {
        if (!STRING_DESC.equals(struct.field.getSignature()) || struct.field.getConstantValue() == null) {
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.