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

com.romansl.url.Host 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 Host extends URL {
    private final String mName;

    Host(final URL next, final String name) {
        super(next);
        mName = name;
    }

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

    @Override
    protected void format(final Appendable out) throws IOException {
        if (mName != null) {
            out.append(mName);
        }
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy