コード例 #1
0
 /**
  * Filters the classes to be transformed.
  *
  * @param definition the definition
  * @param classMetaData the meta-data for the class
  * @param cg the class to filter
  * @return boolean true if the method should be filtered away
  */
 private boolean classFilter(
     final AspectWerkzDefinition definition,
     final ClassMetaData classMetaData,
     final ClassGen cg) {
   if (cg.isInterface()
       || TransformationUtil.hasSuperClass(
           classMetaData, "org.codehaus.aspectwerkz.attribdef.aspect.Aspect")
       || TransformationUtil.hasSuperClass(
           classMetaData, "org.codehaus.aspectwerkz.xmldef.advice.AroundAdvice")
       || TransformationUtil.hasSuperClass(
           classMetaData, "org.codehaus.aspectwerkz.xmldef.advice.PreAdvice")
       || TransformationUtil.hasSuperClass(
           classMetaData, "org.codehaus.aspectwerkz.xmldef.advice.PostAdvice")) {
     return true;
   }
   String className = cg.getClassName();
   if (definition.inExcludePackage(className)) {
     return true;
   }
   if (!definition.inIncludePackage(className)) {
     return true;
   }
   if (definition.hasExecutionPointcut(classMetaData)
       || definition.hasThrowsPointcut(classMetaData)) {
     return false;
   }
   return true;
 }
コード例 #2
0
 /**
  * Filters the methods to be transformed.
  *
  * @param definition the definition
  * @param classMetaData the class meta-data
  * @param method the method to filter
  * @return boolean
  */
 private boolean methodFilter(
     final AspectWerkzDefinition definition,
     final ClassMetaData classMetaData,
     final MethodMetaData methodMetaData,
     final Method method) {
   if (method.isAbstract()
       || method.isNative()
       || method.getName().equals("<init>")
       || method.getName().equals("<clinit>")
       || method.getName().startsWith(TransformationUtil.ORIGINAL_METHOD_PREFIX)
       || method.getName().equals(TransformationUtil.GET_META_DATA_METHOD)
       || method.getName().equals(TransformationUtil.SET_META_DATA_METHOD)
       || method.getName().equals(TransformationUtil.CLASS_LOOKUP_METHOD)
       || method.getName().equals(TransformationUtil.GET_UUID_METHOD)) {
     return true;
   } else if (definition.hasExecutionPointcut(classMetaData, methodMetaData)) {
     return false;
   } else if (definition.hasThrowsPointcut(classMetaData, methodMetaData)) {
     return false;
   } else {
     return true;
   }
 }