Skip to content

Commit

Permalink
Add filterAbstract filterNonAbstract for MethodFinder
Browse files Browse the repository at this point in the history
  • Loading branch information
KyuubiRan committed Mar 9, 2024
1 parent 06becef commit cda4060
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
2 changes: 2 additions & 0 deletions EzXHelper/api/EzXHelper.api
Original file line number Diff line number Diff line change
Expand Up @@ -538,10 +538,12 @@ public final class com/github/kyuubiran/ezxhelper/finders/FieldFinder$-Static {
public final class com/github/kyuubiran/ezxhelper/finders/MethodFinder : com/github/kyuubiran/ezxhelper/finders/base/ExecutableFinder, com/github/kyuubiran/ezxhelper/interfaces/IFindSuper {
public static final field -Static Lcom/github/kyuubiran/ezxhelper/finders/MethodFinder$-Static;
public synthetic fun <init> (Lkotlin/sequences/Sequence;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun filterAbstract ()Lcom/github/kyuubiran/ezxhelper/finders/MethodFinder;
public final fun filterByAssignableReturnType (Ljava/lang/Class;)Lcom/github/kyuubiran/ezxhelper/finders/MethodFinder;
public final fun filterByName (Ljava/lang/String;)Lcom/github/kyuubiran/ezxhelper/finders/MethodFinder;
public final fun filterByReturnType (Ljava/lang/Class;)Lcom/github/kyuubiran/ezxhelper/finders/MethodFinder;
public final fun filterFinal ()Lcom/github/kyuubiran/ezxhelper/finders/MethodFinder;
public final fun filterNonAbstract ()Lcom/github/kyuubiran/ezxhelper/finders/MethodFinder;
public final fun filterNonFinal ()Lcom/github/kyuubiran/ezxhelper/finders/MethodFinder;
public final fun filterNonStatic ()Lcom/github/kyuubiran/ezxhelper/finders/MethodFinder;
public final fun filterStatic ()Lcom/github/kyuubiran/ezxhelper/finders/MethodFinder;
Expand Down
2 changes: 1 addition & 1 deletion EzXHelper/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
id 'signing'
}

def versionName = "2.1.0"
def versionName = "2.1.1"

android {
compileSdkVersion = 34
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,27 @@ class MethodFinder private constructor(seq: Sequence<Method>) : ExecutableFinder
// endregion

// region filter modifiers
/**
* Filter if they are abstract.
* @return [MethodFinder] this finder.
*/
fun filterAbstract() = applyThis {
filter { Modifier.isAbstract(this.modifiers) }
exceptMessageScope { condition("filterAbstract") }
}

/**
* Filter if they are non-abstract.
* @return [MethodFinder] this finder.
*/
fun filterNonAbstract() = applyThis {
filter { !Modifier.isAbstract(this.modifiers) }
exceptMessageScope { condition("filterNonAbstract") }
}

/**
* Filter if they are static.
* @return [FieldFinder] this finder.
* @return [MethodFinder] this finder.
*/
fun filterStatic() = applyThis {
sequence = sequence.filter { Modifier.isStatic(it.modifiers) }
Expand All @@ -127,7 +144,7 @@ class MethodFinder private constructor(seq: Sequence<Method>) : ExecutableFinder

/**
* Filter if they are non-static.
* @return [FieldFinder] this finder.
* @return [MethodFinder] this finder.
*/
fun filterNonStatic() = applyThis {
sequence = sequence.filter { !Modifier.isStatic(it.modifiers) }
Expand All @@ -136,7 +153,7 @@ class MethodFinder private constructor(seq: Sequence<Method>) : ExecutableFinder

/**
* Filter if they are final.
* @return [FieldFinder] this finder.
* @return [MethodFinder] this finder.
*/
fun filterFinal() = applyThis {
sequence = sequence.filter { Modifier.isFinal(it.modifiers) }
Expand All @@ -145,7 +162,7 @@ class MethodFinder private constructor(seq: Sequence<Method>) : ExecutableFinder

/**
* Filter if they are non-final.
* @return [FieldFinder] this finder.
* @return [MethodFinder] this finder.
*/
fun filterNonFinal() = applyThis {
sequence = sequence.filter { !Modifier.isFinal(it.modifiers) }
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
加入Telegram群组来获取帮助: [![Telegram](https://img.shields.io/badge/Join-Telegram-blue)](https://t.me/EzXHelper)

一个使Xposed模块开发变的更轻松的工具库,2.x版本已支持Java!
2.x版本已经发布!最新版为`2.1.0` 旧版本请看`1.x`分支
2.x版本已经发布!最新版为`2.1.1` 旧版本请看`1.x`分支

### 使用本库的项目

Expand Down
2 changes: 1 addition & 1 deletion README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Join Telegram group to get
help: [![Telegram](https://img.shields.io/badge/Join-Telegram-blue)](https://t.me/EzXHelper)

A library to make Xposed modules development easier, 2.x version supports Java!
2.x is released now! The latest version is `2.1.0`. Old version please look the `1.x` branch.
2.x is released now! The latest version is `2.1.1`. Old version please look the `1.x` branch.

### Projects that use this library

Expand Down

0 comments on commit cda4060

Please sign in to comment.