class WhitelistOptionParser {

    Set<Permission> parseTargetOperation(String inputOption, IResource resource)
    {
        String operationString = stripOptionPrefix(inputOption).toUpperCase();

        if (ALL_OPERATIONS.equals(operationString))
        {
            return resource.applicablePermissions();
        }

        try
        {
            return ImmutableSet.of(Permission.valueOf(operationString));
        }
        catch (IllegalArgumentException e)
        {
            throw Exceptions.appendCause(new InvalidRequestException("Invalid whitelist option: " + e.getMessage()), e);
        }
    }

}