Class HttpIntegerHeader

java.lang.Object
org.apache.juneau.http.header.HttpHeaderBean
org.apache.juneau.http.header.HttpIntegerHeader
All Implemented Interfaces:
HttpHeader
Direct Known Subclasses:
Age, MaxForwards

public class HttpIntegerHeader extends HttpHeaderBean
Base for integer headers.
Since:
9.2.1
  • Field Details

  • Constructor Details

    • HttpIntegerHeader

      protected HttpIntegerHeader(String name, String wireValue)
      Constructor.
      Parameters:
      name - Header name. Must not be null.
      wireValue - Wire value. Can be null or empty, in which case the parsed value is null.
    • HttpIntegerHeader

      protected HttpIntegerHeader(String name, Integer typedValue)
      Constructor.
      Parameters:
      name - Header name. Must not be null.
      typedValue - The integer value. Can be null, in which case the parsed value is null.
    • HttpIntegerHeader

      protected HttpIntegerHeader(String name, Supplier<?> supplier, int lazyMode)
      Constructor with lazy value supplier.
      Parameters:
      name - Header name. Must not be null.
      supplier - The lazy value supplier. Must not be null.
      lazyMode - Either LAZY_WIRE_STRING or LAZY_INTEGER.
  • Method Details

    • of

      public static HttpIntegerHeader of(String name, String wireValue)
      Creates an HttpIntegerHeader by parsing the given wire-format value.
      Parameters:
      name - Header name. Must not be null.
      wireValue - Wire value. May be null or empty.
      Returns:
      A new instance. Never null.
    • of

      public static HttpIntegerHeader of(String name, Integer typedValue)
      Creates an HttpIntegerHeader with the given typed value.
      Parameters:
      name - Header name. Must not be null.
      typedValue - The integer value. May be null.
      Returns:
      A new instance. Never null.
    • asInteger

    • getValue

      public String getValue()
      Returns the wire-format value of this header.
      Specified by:
      getValue in interface HttpHeader
      Overrides:
      getValue in class HttpHeaderBean
      Returns:
      The wire value, or null if the value is unset.
    • orElse

      public Integer orElse(Integer other)
      Returns the parsed value of this header, or the specified default if unset.
      Parameters:
      other - The default value. Can be null.
      Returns:
      The parsed value, or other if the value is unset. Can be null if other is null.
    • toInteger

      public Integer toInteger()
      Returns the parsed value of this header.
      Returns:
      The parsed value, or null if the value is unset.