DefaultHeader

class DefaultHeader(delegate: MutableMap<String, String> = mutableMapOf(), var isReadOnly: Boolean = false) : Header, MutableMap<String, String>

Default implementation of the Header interface.

This class provides a mutable header implementation that can be made read-only. It delegates map operations to an internal mutable map while enforcing read-only constraints.

Author

ahoo wang

Parameters

delegate

The underlying mutable map that stores header key-value pairs

Constructors

Link copied to clipboard
constructor(delegate: MutableMap<String, String> = mutableMapOf(), isReadOnly: Boolean = false)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override var isReadOnly: Boolean

Whether this header is read-only (volatile for thread safety)

Functions

Link copied to clipboard
open override fun clear()

Removes all mappings from this header.

Link copied to clipboard
open override fun copy(): Header

Creates a copy of this header.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun put(key: String, value: String): String?

Associates the specified value with the specified key in this header.

Link copied to clipboard
open override fun putAll(from: Map<out String, String>)

Copies all of the mappings from the specified map to this header.

Link copied to clipboard
open override fun remove(key: String): String?

Removes the mapping for the specified key from this header if present.

open override fun remove(key: String, value: String): Boolean

Removes the entry for the specified key only if it is currently mapped to the specified value.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
open override fun withReadOnly(): Header

Makes this header read-only and returns it.