org.apache.hc.core5.http.message

## Class BasicHeaderElement

- java.lang.Object
- - org.apache.hc.core5.http.message.BasicHeaderElement

- All Implemented Interfaces:
    HeaderElement

      public class BasicHeaderElement
      extends Object
      implements HeaderElement

  Basic implementation of `HeaderElement`
  Since:
    4.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BasicHeaderElement(String name, String value)` Constructor with name and value.
    `BasicHeaderElement(String name, String value, NameValuePair[] parameters)` Constructor with name, value and parameters.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getName()` Returns header element name.
    `NameValuePair` | `getParameter(int index)` Returns parameter with the given index.
    `NameValuePair` | `getParameterByName(String name)` Returns the first parameter with the given name.
    `int` | `getParameterCount()` Returns the total count of parameters.
    `NameValuePair[]` | `getParameters()` Returns an array of name / value pairs.
    `String` | `getValue()` Returns header element value.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### BasicHeaderElement

          public BasicHeaderElement(String name,
                            String value,
                            NameValuePair[] parameters)

      Constructor with name, value and parameters.
      Parameters:
        `name` - header element name
        `value` - header element value. May be `null`
        `parameters` - header element parameters. May be `null`. Parameters are copied by reference, not by value

    - #### BasicHeaderElement

          public BasicHeaderElement(String name,
                            String value)

      Constructor with name and value.
      Parameters:
        `name` - header element name
        `value` - header element value. May be `null`

  - ### Method Detail

    - #### getName

          public String getName()

      Description copied from interface: `HeaderElement`
      Returns header element name.
      Specified by:
        `getName` in interface `HeaderElement`
      Returns:
        header element name

    - #### getValue

          public String getValue()

      Description copied from interface: `HeaderElement`
      Returns header element value.
      Specified by:
        `getValue` in interface `HeaderElement`
      Returns:
        header element value

    - #### getParameters

          public NameValuePair[] getParameters()

      Description copied from interface: `HeaderElement`
      Returns an array of name / value pairs.
      Specified by:
        `getParameters` in interface `HeaderElement`
      Returns:
        array of name / value pairs

    - #### getParameterCount

          public int getParameterCount()

      Description copied from interface: `HeaderElement`
      Returns the total count of parameters.
      Specified by:
        `getParameterCount` in interface `HeaderElement`
      Returns:
        parameter count

    - #### getParameter

          public NameValuePair getParameter(int index)

      Description copied from interface: `HeaderElement`
      Returns parameter with the given index.
      Specified by:
        `getParameter` in interface `HeaderElement`
      Parameters:
        `index` - index
      Returns:
        name / value pair

    - #### getParameterByName

          public NameValuePair getParameterByName(String name)

      Description copied from interface: `HeaderElement`
      Returns the first parameter with the given name.
      Specified by:
        `getParameterByName` in interface `HeaderElement`
      Parameters:
        `name` - parameter name
      Returns:
        name / value pair

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2005–2020 The Apache Software Foundation. All rights reserved.