@SuppressWarnings("unchecked")
  @Override
  public @Nullable Object get(File file, String attribute) {
    switch (attribute) {
      case "uid":
        UserPrincipal user = (UserPrincipal) file.getAttribute("owner", "owner");
        return getUniqueId(user);
      case "gid":
        GroupPrincipal group = (GroupPrincipal) file.getAttribute("posix", "group");
        return getUniqueId(group);
      case "mode":
        Set<PosixFilePermission> permissions =
            (Set<PosixFilePermission>) file.getAttribute("posix", "permissions");
        return toMode(permissions);
      case "ctime":
        return file.getCreationTime();
      case "rdev":
        return 0L;
      case "dev":
        return 1L;
      case "ino":
        return file.id();
      case "nlink":
        return file.links();
      default:
        return null;
    }
  }
Returns an ID that is guaranteed to be the same for any invocation with equal objects.
jimfs/src/main/java/com/google/common/jimfs/UnixAttributeProvider.java