Record Class JobsRest.Restock

java.lang.Object
java.lang.Record
org.apache.juneau.petstore.console.ops.JobsRest.Restock
Record Components:
perSpecies - How many pets of each species to add (1-50 each).
idempotencyKey - The client-minted key; resubmits with the same key return the same job.
slowMs - How long to wait before restocking, in whole milliseconds (0-10000), so a demo can cancel before the effect.
holdMs - How long to hold after restocking, in whole milliseconds (0-10000, default 1000), so a demo can cancel after the effect.
Enclosing class:
JobsRest

public static record JobsRest.Restock(Map<Species,Integer> perSpecies, String idempotencyKey, int slowMs, int holdMs) extends Record
The restock request.
Example:

// Wire form: {perSpecies:{DOG:2, CAT:1}, idempotencyKey:'7f3c...'} var r = new Restock(Map.of(Species.DOG, 2), "7f3c", 0, 1000);

  • Constructor Summary

    Constructors
    Constructor
    Description
    Restock(Map<Species,Integer> perSpecies, String idempotencyKey, int slowMs, int holdMs)
    Creates an instance of a Restock record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the holdMs record component.
    Returns the value of the idempotencyKey record component.
    of(JsonMap body)
    Reads a restock from any of its wire shapes: the API form {perSpecies:{DOG:2}, idempotencyKey}, the dialog form the views runtime posts, {action, targetId, idempotencyKey, fields:{DOG:"2"}}, or the job-log card's flat form {DOG:2, slowMs:0, idempotencyKey}.
    Returns the value of the perSpecies record component.
    int
    Returns the value of the slowMs record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Restock

      public Restock(Map<Species,Integer> perSpecies, String idempotencyKey, int slowMs, int holdMs)
      Creates an instance of a Restock record class.
      Parameters:
      perSpecies - the value for the perSpecies record component
      idempotencyKey - the value for the idempotencyKey record component
      slowMs - the value for the slowMs record component
      holdMs - the value for the holdMs record component
  • Method Details

    • of

      public static JobsRest.Restock of(JsonMap body)
      Reads a restock from any of its wire shapes: the API form {perSpecies:{DOG:2}, idempotencyKey}, the dialog form the views runtime posts, {action, targetId, idempotencyKey, fields:{DOG:"2"}}, or the job-log card's flat form {DOG:2, slowMs:0, idempotencyKey}. In the dialog and flat forms a blank, null or 0 count means "none of that species". Any form may carry slowMs and holdMs; each must be a whole number of milliseconds, so a decimal such as 1.5 is rejected rather than truncated.
      Parameters:
      body - The request body.
      Returns:
      The restock.
      Throws:
      BadRequest - If a species is unknown, a count is not a whole number, slowMs is not a whole number 0-10000, or holdMs is not a whole number 0-10000.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • perSpecies

      Returns the value of the perSpecies record component.
      Returns:
      the value of the perSpecies record component
    • idempotencyKey

      Returns the value of the idempotencyKey record component.
      Returns:
      the value of the idempotencyKey record component
    • slowMs

      public int slowMs()
      Returns the value of the slowMs record component.
      Returns:
      the value of the slowMs record component
    • holdMs

      public int holdMs()
      Returns the value of the holdMs record component.
      Returns:
      the value of the holdMs record component