Interface StructuredField

All Known Implementing Classes:
StructuredBoolean, StructuredBytes, StructuredDecimal, StructuredDictionary, StructuredInnerList, StructuredInteger, StructuredItem, StructuredList, StructuredString, StructuredToken

public interface StructuredField
Common interface for all Structured Fields
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    parse(String httpHeader)
    Parses given string for Structured Field, according to the specification
    Serializes this item to String according to the specification
  • Method Details

    • serialize

      String serialize()
      Serializes this item to String according to the specification

      Both value and parameters are serialized

      Returns:
      Serialized representation of this Structured Field
      See Also:
    • parse

      static StructuredField parse(String httpHeader) throws StructuredException
      Parses given string for Structured Field, according to the specification

      Class of returned value depends on parsed content, and it can be any class implementing StructuredField interface. In case of ambiguity, the simplest implementation is returned (Item then List then Dictionary). For example:

      • ok is a valid Token and single-element List of Tokens and single-element Dictionary with ok key and true value. Here, StructuredToken will be returned.
      • ok, not is a valid List of Tokens and a Dictionary with true values. Here, StructuredList will be returned.
      To avoid ambiguity, use parse() methods in concrete classes
      Parameters:
      httpHeader - String to parse, e.g. an HTTP header
      Returns:
      Parsed Structured Field
      Throws:
      StructuredException - Thrown in case of malformatted string
      See Also: