Class StructuredParameters

java.lang.Object
net.visma.autopay.http.structured.StructuredParameters
All Implemented Interfaces:
StructuredMap

public final class StructuredParameters extends Object implements StructuredMap
Class representing Structured Parameters
See Also:
  • Method Details

    • of

      public static StructuredParameters of(Map<String,?> parameters)
      Creates Structured Parameters from given map

      Order of Map entries is preserved. For supported value types and conversion rules see StructuredList.of(Collection).*

      Parameters:
      parameters - Parameter map
      Returns:
      Created Structured Parameters
      Throws:
      IllegalArgumentException - Invalid keys or values
    • of

      public static StructuredParameters of(Object... keysAndValues)
      Creates Structured Parameters from provided keys and values.

      Keys and values should be provided in alternate indices of the vararg param. Order of Map entries is preserved.

      Keys are created using from "even" vararg items, using Object.toString(). Values are created from "odd" vararg items, using conversion described at StructuredList.of(Collection).

      Parameters:
      keysAndValues - Alternating keys and values: key1, value1, key2, value2, ...
      Returns:
      Created Structured Parameters
      Throws:
      IllegalArgumentException - Invalid keys or values
    • itemMap

      public <T extends StructuredItem> Map<String,T> itemMap()
      Description copied from interface: StructuredMap
      Returns Map of Structured Items stored in this Dictionary or Parameters. Keys or returned map correspond to Dictionary or Parameters keys. Values are StructuredItem members of Dictionary or Parameters.
      Specified by:
      itemMap in interface StructuredMap
      Type Parameters:
      T - Specific Item class if needed. No type check is performed, only simple casting.
      Returns:
      Underlying map of StructuredItem objects
    • equals

      public boolean equals(Object o)
      Compares the specified object with these Structured Parameters for equality. Returns true if the given object is of the same class as these Parameters, underlying map has the same keys and values.
      Overrides:
      equals in class Object
      Parameters:
      o - Object to be compared with these Structured Parameters
      Returns:
      True is specified object is equal to these Structured Parameters
    • hashCode

      public int hashCode()
      Returns hash code for these Structured Parameters. The hash code is a combination of hash codes of Parameters entries.
      Overrides:
      hashCode in class Object
      Returns:
      The hash code for these Structured Parameters
    • toString

      public String toString()
      Returns the string representation of these Structured Parameters, which is the same as serialized representation.
      Overrides:
      toString in class Object
      Returns:
      A string representation of these Structured Parameters
      See Also:
      • serialize()