Skip to content

izzy-404/Xerath

 
 

Repository files navigation

简体中文 | English |

Xerath

Xerath 是一个通过 [自定义注解]+ASM + Gradle Transform API 实现的一套功能强大,方便开发,并且能够有效减少重复代码的Android Aop 框架。
旨在编译器进行全局性的修改,来完成一些诸如方法耗时统计,异常收集,拦截,动态代理等特殊需求。
核心思想基于AOP编程,AOP为Aspect Oriented Programming的缩写,意为:面向切面编程。
本项目为AOP思想在Android上的运用与实战,功能对标基于AspectJ的开源项目AopArms

1.引入方式

待上传到Maven,目前可以clone项目然后主动依赖

2.基本使用

1.统计方法耗时
在目标方法上增加@CalculateTime注解

    @CalculateTime
    public static void CalculateTimeMethod() {
        //do something
    }

2.限制方法频繁调用
在目标方法上增加@Xerath_LimitCall(time = 1000L)注解,其中time为频繁调用的时间阈值

    @Xerath_LimitCall(time = 1000L)
    public static void doubleClick() {
        //do something
    }

3.try-catch异常捕获
在目标方法上增加@TryCatch注解

    @TryCatch
    public static void tryCatchMethod() {
        int a = 1 / 0;
    }

3.功能列表(暂定)


License

Copyright 2021, Jiang Zhengnan

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

🔪 AOP development framework implemented through *Annotation + ASM + Gradle Transform API* for Android🤖

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Java 89.5%
  • Groovy 10.1%
  • Shell 0.4%