class EntityTagHeaderDelegate implements RuntimeDelegate.HeaderDelegate<EntityTag> {

    @Override
    public String toString(EntityTag entityTag) {
        if (entityTag == null) {
            throw new IllegalArgumentException();
        }
        StringBuilder sb = new StringBuilder();
        if (entityTag.isWeak()) {
            sb.append('W').append('/');
        }

        sb.append('"');
        HeaderHelper.appendEscapeQuote(sb, entityTag.getValue());
        sb.append('"');

        return sb.toString();
    }

}