Class StructuredToken

java.lang.Object
net.visma.autopay.http.structured.StructuredItem
net.visma.autopay.http.structured.StructuredToken
All Implemented Interfaces:
StructuredField

public final class StructuredToken extends StructuredItem
Class representing Structured Tokens. Also used as "base" Tokens in Structured parameters.
See Also:
  • Method Details

    • of

      public static StructuredToken of(String value)
      Creates Structured Token of given value, without parameters
      Parameters:
      value - Item value
      Returns:
      Created Structured Token
      Throws:
      IllegalArgumentException - Invalid characters =
    • withParams

      public static StructuredToken withParams(String value, Map<String,?> parameters)
      Creates Structured String of given value and parameters
      Parameters:
      value - Item value
      parameters - Parameter map. For details, check StructuredParameters.of(Map).
      Returns:
      Created Structured Token
      Throws:
      IllegalArgumentException - Invalid characters
    • withParams

      public static StructuredToken withParams(String value, StructuredParameters parameters)
      Creates Structured String of given value and parameters
      Parameters:
      value - Item value
      parameters - Structured Parameters
      Returns:
      Created Structured Token
      Throws:
      IllegalArgumentException - Invalid characters
    • parse

      public static StructuredToken parse(String httpHeader) throws StructuredException
      Parses given string for Structured Token, according to the specification
      Parameters:
      httpHeader - String to parse, e.g. HTTP header
      Returns:
      Parsed Structured Token
      Throws:
      StructuredException - Thrown in case of malformatted string or wrong item type
      See Also:
    • equals

      public boolean equals(Object o)
      Description copied from class: StructuredItem
      Compares the specified object with this Structured Item for equality. Returns true if the given object is of the same class as this Item, it has the same value and properties.
      Overrides:
      equals in class StructuredItem
      Parameters:
      o - Object to be compared with this Structured Item
      Returns:
      True is specified object is equal to this Structured Item
    • hashCode

      public int hashCode()
      Description copied from class: StructuredItem
      Returns hash code for this Structured Item. The hash code is a combination of hash codes of Item parameters and Item value.
      Overrides:
      hashCode in class StructuredItem
      Returns:
      The hash code for this Structured Item