Enum Class MrcpHeaderName

java.lang.Object
java.lang.Enum<MrcpHeaderName>
com.bytedesk.call.mrcp4j.message.header.MrcpHeaderName
All Implemented Interfaces:
Serializable, Comparable<MrcpHeaderName>, Constable

public enum MrcpHeaderName extends Enum<MrcpHeaderName>
Defines all valid MRCPv2 header names and provides factory methods for creating header value objects from header value strings.
Author:
Niels Godfredsen <ngodfredsen@users.sourceforge.net>
  • Enum Constant Details

  • Field Details

  • Constructor Details

    • MrcpHeaderName

      private MrcpHeaderName(String name)
    • MrcpHeaderName

      private MrcpHeaderName(String name, Class<?> valueClass)
    • MrcpHeaderName

      private MrcpHeaderName(String name, ValueFactory valueFactory)
  • Method Details

    • values

      public static MrcpHeaderName[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static MrcpHeaderName valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • isMatch

      public boolean isMatch(String name)
      Tests whether an MRCP header field-name in string format matches this enum instance.
      Parameters:
      name - MRCP header field-name.
      Returns:
      true if the specified field-name matches this enum instance.
    • isGeneric

      public boolean isGeneric()
      Tests whether this instance represents a header name corresponding to a generic-header.
      Returns:
      true if this header name corresponds to a generic-header.
    • isApplicableTo

      public boolean isApplicableTo(MrcpResourceType type)
      Tests whether this header name is applicable to a specified MRCP resource type. Note that some resources may not support TODOC...
      Parameters:
      type - the MRCP resource type to be tested against.
      Returns:
      true if this header name corresponds to the specified resource type.
    • toString

      public String toString()
      Overrides:
      toString in class Enum<MrcpHeaderName>
    • fromString

      public static MrcpHeaderName fromString(String str) throws IllegalArgumentException
      Converts an MRCP header field-name in string format to the appropriate MRCP4J enum value.
      Parameters:
      str - MRCP header field-name
      Returns:
      the header name enum instance corresponding to the string value specified
      Throws:
      IllegalArgumentException - if the string value specified does not correspond to an existing MRCP header field-name
    • constructHeader

      public MrcpHeader constructHeader(Object valueObject) throws ClassCastException, IllegalArgumentException
      Throws:
      ClassCastException
      IllegalArgumentException
    • createHeaderValue

      public Object createHeaderValue(String valueString) throws IllegalValueException
      Creates the value object applicable to this MrcpHeaderName from a value string.
      Parameters:
      valueString - the string value for the value object instance.
      Returns:
      value object for the header using the MrcpHeaderName and supplied value string.
      Throws:
      IllegalValueException - if the value string passed is not valid for the header type.
    • createHeader

      public MrcpHeader createHeader(String valueString)
      Creates a new MrcpHeader instance based on this MrcpHeaderName.
      Parameters:
      valueString - the string value for the new MrcpHeader instance.
      Returns:
      a new instance using the MrcpHeaderName and supplied value.
    • createHeader

      public static MrcpHeader createHeader(String name, String valueString)
      Factory method to create new MrcpHeader instances.
      Parameters:
      name - field-name of the header.
      valueString - field-value of the header.
      Returns:
      a new instance of MrcpHeaderName using the supplied field-name and field-value.