class LinkHeaderProvider implements HeaderDelegate<Link> {

    public String toString(Link link) {
        StringBuilder sb = new StringBuilder();

        sb.append('<');
        sb.append(link.getUri());
        sb.append('>');

        String rels = link.getRel();
        if (!rels.isEmpty()) {
            sb.append(';').append(REL).append('=');
            writeListParamValues(sb, rels);
        }
        if (link.getTitle() != null) {
            sb.append(';').append(TITLE).append("=\"").append(link.getTitle()).append('"');
        }
        if (link.getType() != null) {
            sb.append(';').append(TYPE).append('=').append(link.getType());
        }
        for (Map.Entry<String, String> entry : link.getParams().entrySet()) {
            if (KNOWN_PARAMETERS.contains(entry.getKey())) {
                continue;
            }
            sb.append(';').append(entry.getKey()).append('=');
            writeListParamValues(sb, entry.getValue());
        }

        return sb.toString();

    }

}