@Override
  public ImmutableMap<String, ?> defaultValues(Map<String, ?> userProvidedDefaults) {
    Object userProvidedGroup = userProvidedDefaults.get("posix:group");

    UserPrincipal group = DEFAULT_GROUP;
    if (userProvidedGroup != null) {
      if (userProvidedGroup instanceof String) {
        group = createGroupPrincipal((String) userProvidedGroup);
      } else {
        throw new IllegalArgumentException(
            "invalid type "
                + userProvidedGroup.getClass().getName()
                + " for attribute 'posix:group': should be one of "
                + String.class
                + " or "
                + GroupPrincipal.class);
      }
    }

    Object userProvidedPermissions = userProvidedDefaults.get("posix:permissions");

    Set<PosixFilePermission> permissions = DEFAULT_PERMISSIONS;
    if (userProvidedPermissions != null) {
      if (userProvidedPermissions instanceof String) {
        permissions =
            Sets.immutableEnumSet(
                PosixFilePermissions.fromString((String) userProvidedPermissions));
      } else if (userProvidedPermissions instanceof Set) {
        permissions = toPermissions((Set<?>) userProvidedPermissions);
      } else {
        throw new IllegalArgumentException(
            "invalid type "
                + userProvidedPermissions.getClass().getName()
                + " for attribute 'posix:permissions': should be one of "
                + String.class
                + " or "
                + Set.class);
      }
    }

    return ImmutableMap.of(
        "posix:group", group,
        "posix:permissions", permissions);
  }
Attribute provider that provides the {@link PosixFileAttributeView} ("posix") and allows reading
of {@link PosixFileAttributes}.

@author Colin Decker
jimfs/src/main/java/com/google/common/jimfs/PosixAttributeProvider.java