Skip to content

Commit 94d8c1c

Browse files
committed
refactor: simplify deprecated actions
1 parent 3afb9d7 commit 94d8c1c

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

src/main/java/io/weaviate/client/v1/rbac/model/RbacAction.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@
2424
interface RbacAction {
2525
String getValue();
2626

27+
/**
28+
* Returns true if the action is hard deprecated.
29+
*
30+
* <p>
31+
* Override default return for a deprecated enum value like so:
32+
*
33+
* <pre>{@code
34+
* OLD_ACTION("old_action") {
35+
* &#64;Override
36+
* public boolean isDeprecated() { return true; }
37+
* };
38+
* }</pre>
39+
*/
2740
default boolean isDeprecated() {
2841
return false;
2942
}

src/main/java/io/weaviate/client/v1/rbac/model/RolesPermission.java

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,15 @@ public enum Action implements RbacAction {
4545
* and should only be used internally to read legacy permissions.
4646
*/
4747
@Deprecated
48-
MANAGE("manage_roles", true);
49-
50-
Action(String value) {
51-
this(value, false);
52-
}
48+
MANAGE("manage_roles") {
49+
@Override
50+
public boolean isDeprecated() {
51+
return true;
52+
};
53+
};
5354

5455
@Getter
5556
private final String value;
56-
57-
private final boolean deprecated;
58-
59-
public boolean isDeprecated() {
60-
return deprecated;
61-
}
6257
}
6358

6459
public enum Scope {

0 commit comments

Comments
 (0)