class MailRepositoryUrl {

    public static MailRepositoryUrl from(String url) {
        Preconditions.checkNotNull(url);
        Preconditions.checkArgument(url.contains(PROTOCOL_SEPARATOR),
            "The expected format is: <protocol> \"%s\" <path>", PROTOCOL_SEPARATOR);

        List<String> urlParts = Splitter.on(PROTOCOL_SEPARATOR).splitToList(url);

        Protocol protocol = new Protocol(urlParts.get(PROTOCOL_PART));
        MailRepositoryPath path = MailRepositoryPath.from(
            Joiner.on(PROTOCOL_SEPARATOR)
                .join(Iterables.skip(urlParts, SKIP_PROTOCOL)));

        return new MailRepositoryUrl(path, protocol);
    }

    private  MailRepositoryUrl(MailRepositoryPath path, Protocol protocol);

}