class GroupRoleManager extends DefaultRoleManager {
    /**
     * GroupRoleManager is the constructor for creating an instance of the
     * GroupRoleManager implementation.
     *
     * @param maxHierarchyLevel the maximized allowed RBAC hierarchy level.
     */
    public GroupRoleManager(int maxHierarchyLevel) {
        super(maxHierarchyLevel);
    }

    /**
     * hasLink determines whether role: name1 inherits role: name2.
     * domain is a prefix to the roles.
     */
    @Override
    public boolean hasLink(String name1, String name2, String... domain) {<FILL_FUNCTION_BODY>}
}

        if(super.hasLink(name1, name2, domain)) {
            return true;
        }
        // check name1's groups
        if (domain.length == 1) {
            try {
                List<String> groups = Optional.ofNullable(super.getRoles(name1)).orElse(new ArrayList<>());
                for(String group : groups) {
                    if(hasLink(group, name2, domain)) {
                        return true;
                    }
                }
            } catch (IllegalArgumentException ignore) {
                return false;
            }
        }
        return false;
    
<methods>public void <init>(int) ,public void <init>(int, BiPredicate<java.lang.String,java.lang.String>, BiPredicate<java.lang.String,java.lang.String>) ,public void addDomainMatchingFunc(java.lang.String, BiPredicate<java.lang.String,java.lang.String>) ,public transient void addLink(java.lang.String, java.lang.String, java.lang.String[]) ,public void addMatchingFunc(java.lang.String, BiPredicate<java.lang.String,java.lang.String>) ,public void clear() ,public transient void deleteLink(java.lang.String, java.lang.String, java.lang.String[]) ,public transient List<java.lang.String> getRoles(java.lang.String, java.lang.String[]) ,public transient List<java.lang.String> getUsers(java.lang.String, java.lang.String[]) ,public synchronized transient boolean hasLink(java.lang.String, java.lang.String, java.lang.String[]) ,public void printRoles() ,public java.lang.String toString() <variables>private static final java.lang.String DEFAULT_DOMAIN,Map<java.lang.String,org.casbin.jcasbin.rbac.Role> allRoles,BiPredicate<java.lang.String,java.lang.String> matchingFunc,private SyncedLRUCache<java.lang.String,java.lang.Boolean> matchingFuncCache,final non-sealed int maxHierarchyLevel