All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.romansl.url.Scheme Maven / Gradle / Ivy

Go to download

URL builder based on pure functional principles. No side effects. Immutable. Thread-safe. Easy to use.

The newest version!
package com.romansl.url;

import java.io.IOException;

class Scheme extends URL {
    private final String mScheme;

    Scheme(final URL url, final String scheme) {
        super(url);
        mScheme = scheme;
    }

    @Override
    protected void store(final FinalURL storage) {
        if (storage.mScheme == null) {
            storage.mScheme = this;
        }
    }

    @Override
    protected void format(final Appendable out) throws IOException {
        if (mScheme != null && mScheme.length() != 0) {
            out.append(mScheme);
            out.append("://");
        }
    }

    @Override
    String getStringContent() {
        return mScheme == null ? "" : mScheme;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy