Add RoleHierarchyImpl#of

Closes gh-13788
This commit is contained in:
Toshiaki Maki
2023-09-09 12:10:47 +09:00
committed by Josh Cummings
parent e6bea1cfa1
commit c1b3351569
2 changed files with 39 additions and 14 deletions

View File

@@ -125,6 +125,17 @@ public class RoleHierarchyImpl implements RoleHierarchy {
return new Builder(rolePrefix);
}
/**
* Create a role hierarchy instance with the given definition
* @param roleHierarchyStringRepresentation String definition of the role hierarchy.
* @return role hierarchy instance
*/
public static RoleHierarchyImpl of(String roleHierarchyStringRepresentation) {
RoleHierarchyImpl hierarchy = new RoleHierarchyImpl();
hierarchy.setHierarchy(roleHierarchyStringRepresentation);
return hierarchy;
}
/**
* Set the role hierarchy and pre-calculate for every role the set of all reachable
* roles, i.e. all roles lower in the hierarchy of every given role. Pre-calculation