org.fourthline.cling.model.message.header

## Class UpnpHeader<T>

- java.lang.Object
- - org.fourthline.cling.model.message.header.UpnpHeader<T>

- Direct Known Subclasses:
    AVClientInfoHeader, CallbackHeader, ContentRangeHeader, ContentTypeHeader, DeviceTypeHeader, DeviceUSNHeader, EventSequenceHeader, EXTHeader, HostHeader, InterfaceMacHeader, LocationHeader, MANHeader, MaxAgeHeader, MXHeader, NTEventHeader, NTSHeader, PragmaHeader, RangeHeader, RootDeviceHeader, ServerHeader, ServiceTypeHeader, ServiceUSNHeader, SoapActionHeader, STAllHeader, SubscriptionIdHeader, TimeoutHeader, UDNHeader, UserAgentHeader, USNRootDeviceHeader

      public abstract class UpnpHeader<T>
      extends Object

  Transforms known and standardized UPnP/HTTP headers from/to string representation.

  The `newInstance(org.fourthline.cling.model.message.header.UpnpHeader.Type, String)` method attempts to instantiate the best header subtype for a given header (name) and string value.

  Author:
    Christian Bauer

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `UpnpHeader.Type` Maps a standardized UPnP header to potential header subtypes.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UpnpHeader()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract String` | `getString()`
    `T` | `getValue()`
    `static UpnpHeader` | `newInstance(UpnpHeader.Type type, String headerValue)` Create a new instance of a `UpnpHeader` subtype that matches the given type and value.
    `abstract void` | `setString(String s)`
    `void` | `setValue(T value)`
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### UpnpHeader

          public UpnpHeader()

  - ### Method Detail

    - #### setValue

          public void setValue(T value)

    - #### getValue

          public T getValue()

    - #### setString

          public abstract void setString(String s)
                                  throws InvalidHeaderException

      Parameters:
        `s` - This header's value as a string representation.
      Throws:
        `InvalidHeaderException` - If the value is invalid for this UPnP header.

    - #### getString

          public abstract String getString()

      Returns:
        A string representing this header's value.

    - #### newInstance

          public static UpnpHeader newInstance(UpnpHeader.Type type,
                               String headerValue)

      Create a new instance of a `UpnpHeader` subtype that matches the given type and value.

      This method iterates through all potential header subtype classes as declared in `UpnpHeader.Type`. It creates a new instance of the subtype class and calls its `setString(String)` method. If no `InvalidHeaderException` is thrown, the subtype instance is returned.

      Parameters:
        `type` - The type (or name) of the header.
        `headerValue` - The value of the header.
      Returns:
        The best matching header subtype instance, or `null` if no subtype can be found.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2014 4th Line GmbH, Switzerland. All Rights Reserved.