class CacheControlHeaderDelegate implements RuntimeDelegate.HeaderDelegate<CacheControl> {

    @Override
    public String toString(CacheControl header) {
        StringBuilder buff = new StringBuilder();
        if (!header.isPrivate()) {
            appendString(buff, "public");
        }
        if (header.isPrivate()) {
            appendWithParameters(buff, "private", header.getPrivateFields());
        }
        if (header.isNoCache()) {
            appendWithParameters(buff, "no-cache", header.getNoCacheFields());
        }
        if (header.isNoStore()) {
            appendString(buff, "no-store");
        }
        if (header.isNoTransform()) {
            appendString(buff, "no-transform");
        }
        if (header.isMustRevalidate()) {
            appendString(buff, "must-revalidate");
        }
        if (header.isProxyRevalidate()) {
            appendString(buff, "proxy-revalidate");
        }
        if (header.getMaxAge() >= 0) {
            appendString(buff, Integer.toString(header.getMaxAge()));
        }
        if (header.getSMaxAge() >= 0) {
            appendString(buff, Integer.toString(header.getSMaxAge()));
        }
        for (Map.Entry<String, String> entry : header.getCacheExtension().entrySet()) {
            appendWithSingleParameter(buff, entry.getKey(), entry.getValue());
        }
        return buff.toString();
    }

}