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

com.ionos.network.commons.address.AbstractAddressFormat Maven / Gradle / Ivy

There is a newer version: 0.14.0
Show newest version
package com.ionos.network.commons.address;

import java.io.IOException;

/** Adds a default format method to simplify implementation of the interface.
 * @param  the address class this class offers format functionality for.
 * @see #format(Address)
 * @author Stephan Fuhrmann
 *
 **/
abstract class AbstractAddressFormat
        implements AddressFormat {

    @Override
    public String format(final T address) {
        try {
            return format(address, new StringBuilder()).toString();
        } catch (IOException e) {
            // this should not happen in the StringBuilder
            throw new IllegalStateException("This should not happen in "
                    + "StringBuilder!", e);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy