-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from wyjsonGo/develop
publish v2.4.4 添加路由Tag工具,支持更多对Tag的操作
- Loading branch information
Showing
11 changed files
with
149 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
GoRouter-Api/src/main/java/com/wyjson/router/utils/RouteTagUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package com.wyjson.router.utils; | ||
|
||
import java.util.ArrayList; | ||
|
||
/** | ||
* 单个int有4字节,可以配置31个开关,范围从1到1 << 30 | ||
*/ | ||
public class RouteTagUtils { | ||
|
||
/** | ||
* 是否存在 | ||
* | ||
* @param v | ||
* @param item | ||
* @return | ||
*/ | ||
public static boolean isExist(int v, int item) { | ||
return (v & item) > 0; | ||
} | ||
|
||
/** | ||
* 存在多少个 | ||
* | ||
* @param v | ||
* @return | ||
*/ | ||
public static int getExistCount(int v) { | ||
return Integer.bitCount(v); | ||
} | ||
|
||
/** | ||
* 添加 | ||
* | ||
* @param v | ||
* @param item | ||
* @return | ||
*/ | ||
public static int addItem(int v, int item) { | ||
return v | item; | ||
} | ||
|
||
/** | ||
* 删除 | ||
* | ||
* @param v | ||
* @param item | ||
* @return | ||
*/ | ||
public static int deleteItem(int v, int item) { | ||
return v & ~item; | ||
} | ||
|
||
/** | ||
* 取反 | ||
* | ||
* @param v | ||
* @return | ||
*/ | ||
public static int getNegation(int v) { | ||
return ~v; | ||
} | ||
|
||
/** | ||
* 获取所有存在的 | ||
* | ||
* @param v | ||
* @param itemList | ||
* @return | ||
*/ | ||
public static ArrayList<Integer> getExistList(int v, int... itemList) { | ||
ArrayList<Integer> list = new ArrayList<>(); | ||
for (int item : itemList) { | ||
if (isExist(v, item)) | ||
list.add(item); | ||
} | ||
return list; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
module_common/src/main/java/com/wyjson/module_common/route/RouteTag.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.wyjson.module_common.route; | ||
|
||
/** | ||
* 单个int有4字节,可以配置31个开关,范围从1到1 << 30 | ||
*/ | ||
public interface RouteTag { | ||
|
||
int LOGIN = 1; | ||
int AUTHENTICATION = 1 << 1; | ||
int SAFETY = 1 << 2; | ||
|
||
} |
98 changes: 0 additions & 98 deletions
98
module_common/src/main/java/com/wyjson/module_common/route/utils/RouteTagUtils.java
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
module_user/src/main/java/com/wyjson/module_user/activity/UserInfoActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters