Record Class TransportHeader

java.lang.Object
java.lang.Record
org.apache.juneau.rest.client.TransportHeader
Record Components:
name - The header name. Never null.
value - The header value. Never null.

public record TransportHeader(String name, String value) extends Record
An HTTP header name/value pair as seen by the transport layer.

Unlike HttpHeader, this is a fully-resolved, eagerly-evaluated value; suppliers have already been invoked and null-valued headers have already been filtered out before a TransportRequest is constructed.

Since:
9.2.1
  • Constructor Details

    • TransportHeader

      public TransportHeader(String name, String value)
      Compact canonical constructor — validates that neither field is null.
      Parameters:
      name - The header name. Must not be null.
      value - The header value. Must not be null.
  • Method Details

    • of

      public static TransportHeader of(String name, String value)
      Factory method.
      Parameters:
      name - The header name. Must not be null.
      value - The header value. Must not be null.
      Returns:
      A new instance. Never null.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • value

      public String value()
      Returns the value of the value record component.
      Returns:
      the value of the value record component