public static boolean isAncestorOrSame(URI descendant, URI ancestor) {
    Preconditions.checkNotNull(descendant, "input can not be null");
    Preconditions.checkNotNull(ancestor, "input can not be null");

    if (!stringSame(descendant.getScheme(), ancestor.getScheme())) {
      return false;
    }

    if (!stringSame(descendant.getAuthority(), ancestor.getAuthority())) {
      return false;
    }

    return isAncestorOrSame(getConfigKeyPath(descendant.getPath()), getConfigKeyPath(ancestor.getPath()));
  }
public static boolean isAncestorOrSame ( URI descendant , URI ancestor ) { Preconditions . checkNotNull ( descendant , "input can not be null" ) ; Preconditions . checkNotNull ( ancestor , "input can not be null" ) ; if ( ! stringSame ( descendant . getScheme ( ) , ancestor . getScheme ( ) ) ) { return false ; } if ( ! stringSame ( descendant . getAuthority ( ) , ancestor . getAuthority ( ) ) ) { return false ; } return isAncestorOrSame ( getConfigKeyPath ( descendant . getPath ( ) ) , getConfigKeyPath ( ancestor . getPath ( ) ) ) ; }
Utility method to check whether one URI is the ancestor of the other

return true iff both URI's scheme/authority name match and ancestor's path is the prefix of the descendant's path
@param descendant: the descendant URI to check
@param ancestor  : the ancestor URI to check
@return