class EntityTagHeaderDelegate implements RuntimeDelegate.HeaderDelegate<EntityTag> {

    @Override
    public EntityTag fromString(String header) {
        if (header == null) {
            throw new IllegalArgumentException();
        }

        boolean isWeak = header.startsWith("W/");

        String value;
        if (isWeak) {
            value = cutWeakPrefix(header);
        } else {
            value = header;
        }
        value = value.substring(1, value.length() - 1);
        value = HeaderHelper.removeQuoteEscapes(value);

        return new EntityTag(value, isWeak);
    }

}