@Override public S schemaVersion(@Nullable final JsonSchemaVersion schemaVersion) { if (null != schemaVersion) { putCharSequence(DittoHeaderDefinition.SCHEMA_VERSION, schemaVersion.toString()); } else { removeHeader(DittoHeaderDefinition.SCHEMA_VERSION.getKey()); } return myself; }
@Override public S schemaVersion(@Nullable final JsonSchemaVersion schemaVersion) { if (null != schemaVersion) { putCharSequence(DittoHeaderDefinition.SCHEMA_VERSION, schemaVersion.toString()); } else { removeHeader(DittoHeaderDefinition.SCHEMA_VERSION.getKey()); } return myself; }
/** * Puts the specified CharSequence value to this builder using the key of the specified definition. If the value * is {@code null} a possibly existing value for the same key is removed; thus putting a {@code null} value is same * as removing the key-value-pair. * * @param definition provides the key to be associated with {@code value}. * @param value the value to be associated with the key of {@code definition}. */ protected void putCharSequence(final HeaderDefinition definition, @Nullable final CharSequence value) { if (null != value) { checkNotEmpty(value, definition.getKey()); headers.put(definition.getKey(), value.toString()); } else { removeHeader(definition.getKey()); } }
/** * Puts the specified CharSequence value to this builder using the key of the specified definition. If the value * is {@code null} a possibly existing value for the same key is removed; thus putting a {@code null} value is same * as removing the key-value-pair. * * @param definition provides the key to be associated with {@code value}. * @param value the value to be associated with the key of {@code definition}. */ protected void putCharSequence(final HeaderDefinition definition, @Nullable final CharSequence value) { if (null != value) { checkNotEmpty(value, definition.getKey()); headers.put(definition.getKey(), value.toString()); } else { removeHeader(definition.getKey()); } }