All Superinterfaces:
PayloadProductType, Serializable
All Known Subinterfaces:
PayloadBlock

public interface Payload extends PayloadProductType, Serializable
Class exposes API for populating fields and blocks inside a Payload. This class is used by various builders when creating requests and responses. Support API for creation of iterators that are used to traverse the Payloads blocks.
  • Method Details

    • setAttribute

      Payload setAttribute(String name, int value)
      method assigns an integer value to the specified attribute in this PayloadBlock. Any previously existing value will be replaced with this supplied value. Dot notation addressing is supported in the supplied name.
      Parameters:
      name - the name of the attribute (eg. ABC[2].XYZ[1].TIME)
      value - the integer value of the attribute
      Returns:
      the modified payload to support chaining construct.
      Throws:
      NoSuchElementException - if the caller attempts to set an attribute which is unknown to the associated PayloadSpec.
    • setAttribute

      Payload setAttribute(String name, String value)
      method assigns an String value to the specified attribute in this PayloadBlock. Any previously existing value will be replaced with this supplied value. Dot notation addressing is supported in the supplied name.
      Parameters:
      name - the name of the attribute (eg. ABC[2].XYZ[1].TIME)
      value - the string value of the attribute
      Returns:
      the modified payload to support chaining construct.
      Throws:
      NoSuchElementException - if the caller attempts to set an attribute which is unknown to the associated PayloadSpec.
    • setAttribute

      Payload setAttribute(String name, BigDecimal value)
      method assigns an decimal value to the specified attribute in this PayloadBlock. Any previously existing value will be replaced with this supplied value. BigDecimal is used to represent the decimal. Dot notation addressing is supported in the supplied name.
      Parameters:
      name - the name of the attribute (eg. ABC[2].XYZ[1].TIME)
      value - the BigDecimal value of the attribute
      Returns:
      the modified payload to support chaining construct.
      Throws:
      NoSuchElementException - if the caller attempts to set an attribute which is unknown to the associated PayloadSpec.
    • setAttribute

      Payload setAttribute(String name, long value)
      method assigns an String value to the specified attribute in this PayloadBlock. Any previously existing value will be replaced with this supplied value. Dot notation addressing is supported in the supplied name.
      Parameters:
      name - the name of the attribute (eg. ABC[2].XYZ[1].TIME)
      value - the long value of the attribute
      Returns:
      the modified payload to support chaining construct.
      Throws:
      NoSuchElementException - if the caller attempts to set an attribute which is unknown to the associated PayloadSpec.
    • setAttribute

      Payload setAttribute(String name, ZonedDateTime value)
      method assigns a ZonedDateTime value to the specified attribute in this PayloadBlock. Any previously existing value will be replaced with this supplied value. Dot notation addressing is supported in the supplied name.
      Parameters:
      name - the name of the attribute (eg. ABC[2].XYZ[1].TIME)
      value - the ZonedDateTime value to set into the payload field.
      Returns:
      the modified payload to support chaining construct.
      Throws:
      NoSuchElementException - if the caller attempts to set an attribute which is unknown to the associated PayloadSpec.
    • setAttribute

      Payload setAttribute(String name, Duration unit, BigDecimal amount)
      method assigns an Duration value to the specified attribute in this PayloadBlock. Any previously existing value will be replaced with this supplied value. Dot notation addressing is supported in the supplied name.
      Parameters:
      name - the name of the attribute (eg. ABC[2].XYZ[1].TIME)
      unit - the duration unit to use.
      amount - the amount of units to set, value cannot be null
      Returns:
      the modified payload to support chaining construct.
      Throws:
      NoSuchElementException - if the caller attempts to set an attribute which is unknown to the associated PayloadSpec.
    • setAttribute

      Payload setAttribute(String name, Data unit, BigDecimal amount)
      method assigns an Data value to the specified attribute in this PayloadBlock. Any previously existing value will be replaced with this supplied value. Dot notation addressing is supported in the supplied name.
      Parameters:
      name - the name of the attribute (eg. ABC[2].XYZ[1].TIME)
      unit - the data unit to be used
      amount - the amount of data, value cannot be null
      Returns:
      the modified payload to support chaining construct.
      Throws:
      NoSuchElementException - if the caller attempts to set an attribute which is unknown to the associated PayloadSpec.
    • setAttribute

      Payload setAttribute(String name, Occurrence unit, Integer amount)
      method assigns an Occurrence value to the specified attribute in this PayloadBlock. Any previously existing value will be replaced with this supplied value. Dot notation addressing is supported in the supplied name.
      Parameters:
      name - the name of the attribute (eg. ABC[2].XYZ[1].TIME)
      unit - the duration unit to use.
      amount - the amount of units to set, value cannot be null
      Returns:
      the modified payload to support chaining construct.
      Throws:
      NoSuchElementException - if the caller attempts to set an attribute which is unknown to the associated PayloadSpec.
    • getAttribute

      <T> T getAttribute(String name)
      method returns the attribute value for the provided attribute name. ClassCastException will be thrown if caller attempts to retrieve the attribute as the incorrect data type. Dot notation addressing is supported in the supplied name.
      Type Parameters:
      T - the type of the expected attribute
      Parameters:
      name - the name of the attribute to be retrieved (eg. ABC[2].XYZ[1].TIME)
      Returns:
      the attribute value corresponding to the supplied name. Will return null if the attribute does not exist on the Payload.
      Throws:
      NoSuchElementException - if the caller attempts to get an attribute which is unknown to the associated PayloadSpec during the builder phase (ie. prior to calling usageRequestBuilder.build()).
    • createIterator

      method to create an iterator that will do a depth first traversal of all sub-blocks below this Payload.
      Returns:
      iterator for all sub-blocks of this PayloadBlock.
    • createIterator

      PayloadBlockIterator<PayloadBlock> createIterator(String blockName)
      method to create an iterator that will do a depth first traversal of all sub-blocks below this PayloadBlock that match the supplied blockName.
      Parameters:
      blockName - block name to match. A trailing '*' suffix can be used to do wildcard helps. (eg. CUSTOMER.BALANCE*)
      Returns:
      iterator to traverse all sub-blocks of this Payloadblock that match the supplied blockName.
    • createIterator

      PayloadBlockIterator<PayloadBlock> createIterator(String blockName, String attrName)
      method to create an iterator that will do a depth first traversal of all sub-blocks below this PayloadBlock that match the supplied blockName and attribute name.
      Parameters:
      blockName - block name to match. A trailing '*' suffix can be used to do wildcard helps. (eg. CUSTOMER.BALANCE*)
      attrName - attr name to match.
      Returns:
      iterator to traverse all sub-blocks of this Payloadblock that match the supplied blockName and attr name.
    • createIterator

      PayloadBlockIterator<PayloadBlock> createIterator(String blockName, String attrName, String value)
      method to create an iterator that will do a depth first traversal of all sub-blocks below this PayloadBlock that match the supplied blockName. attribute name and attribute value.
      Parameters:
      blockName - block name to match. A trailing '*' suffix can be used to do wildcard helps. (eg. CUSTOMER.BALANCE*)
      attrName - attr name to match.
      value - attr value to match.
      Returns:
      iterator to traverse all sub-blocks of this Payloadblock that match the supplied blockName, attr name and attr value.
    • getSubBlock

      PayloadBlock getSubBlock(String name, int index)
      method gets the sub-block matching the supplied name and index. Block is implicitly created if not already existing in the payload.
      Parameters:
      name - name of the block to get. Dot notation is NOT supported, this is a non-qualified block name that represents a block with is a direct descendant of this payload.
      index - the index of the block to get.
      Returns:
      the matching block
    • getAttributeInfo

      List<PayloadAttributeInfo> getAttributeInfo()
      method returns meta data about attributes in this Payload.
      Returns:
      meta data about attributes in this Payload
    • getAttributeInfo

      PayloadAttributeInfo getAttributeInfo(String attributeName)
      method returns meta data about the attribute info for the given fully qualified attribute.
      Parameters:
      attributeName - name of the attribute for which the attribute info will be returned
      Returns:
      meta data about all available attributes in this Payload
    • getSubBlockInfo

      List<PayloadBlockInfo> getSubBlockInfo()
      method returns meta data about PayloadBlocks in this Payload.
      Returns:
      meta data about PayloadBlocks in this Payload
    • toDebugString

      String toDebugString()
      method will produce a detailed representation of a payload
      Returns:
      engineer view of the payload
    • hasAttribute

      boolean hasAttribute(String name)
    • getSubBlockOrDefault

      PayloadBlock getSubBlockOrDefault(String blockName, int index)