org.fourthline.cling.support.model.dlna

## Class DLNAAttribute<T>

- java.lang.Object
- - org.fourthline.cling.support.model.dlna.DLNAAttribute<T>

- Direct Known Subclasses:
    DLNAConversionIndicatorAttribute, DLNAFlagsAttribute, DLNAOperationsAttribute, DLNAPlaySpeedAttribute, DLNAProfileAttribute

      public abstract class DLNAAttribute<T>
      extends Object

  Transforms known and standardized DLNA attributes from/to string representation.

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

  Author:
    Christian Bauer, Mario Franco

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `DLNAAttribute.Type` Maps a standardized DLNA attribute to potential attribute subtypes.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DLNAAttribute()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract String` | `getString()`
    `T` | `getValue()`
    `static DLNAAttribute` | `newInstance(DLNAAttribute.Type type, String attributeValue, String contentFormat)` Create a new instance of a `DLNAAttribute` subtype that matches the given type and value.
    `abstract void` | `setString(String s, String cf)`
    `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

    - #### DLNAAttribute

          public DLNAAttribute()

  - ### Method Detail

    - #### setValue

          public void setValue(T value)

    - #### getValue

          public T getValue()

    - #### setString

          public abstract void setString(String s,
                                         String cf)
                                  throws InvalidDLNAProtocolAttributeException

      Parameters:
        `s` - This attribute's value as a string representation.
        `cf` - This attribute's mime type as a string representation, optional.
      Throws:
        `InvalidDLNAProtocolAttributeException` - If the value is invalid for this DLNA attribute.

    - #### getString

          public abstract String getString()

      Returns:
        A string representing this attribute's value.

    - #### newInstance

          public static DLNAAttribute newInstance(DLNAAttribute.Type type,
                                                  String attributeValue,
                                                  String contentFormat)

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

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

      Parameters:
        `type` - The type of the attribute.
        `attributeValue` - The value of the attribute.
        `contentFormat` - The DLNA mime type of the attribute, optional.
      Returns:
        The best matching attribute subtype instance, or `null` if no subtype can be found.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2016 4th Line GmbH, Switzerland. All rights reserved.