/** * <p> * Specifies the permission given to the grantee. * </p> * <p> * If the service returns an enum value that is not available in the current SDK version, {@link #permission} will * return {@link Permission#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #permissionAsString}. * </p> * * @return Specifies the permission given to the grantee. * @see Permission */ public Permission permission() { return Permission.fromValue(permission); }
/** * Use this in place of valueOf to convert the raw string returned by the service into the enum value. * * @param value * real value * @return Permission corresponding to the value */ public static Permission fromValue(String value) { if (value == null) { return null; } return Stream.of(Permission.values()).filter(e -> e.toString().equals(value)).findFirst().orElse(UNKNOWN_TO_SDK_VERSION); }
/** * Use this in place of {@link #values()} to return a {@link Set} of all values known to the SDK. This will return * all known enum values except {@link #UNKNOWN_TO_SDK_VERSION}. * * @return a {@link Set} of known {@link Permission}s */ public static Set<Permission> knownValues() { return Stream.of(values()).filter(v -> v != UNKNOWN_TO_SDK_VERSION).collect(toSet()); } }
@Override public final Builder permission(Permission permission) { this.permission(permission.toString()); return this; }