Class ItemForm

java.lang.Object
swim.structure.Form<Item>
swim.structure.form.ItemForm

public final class ItemForm extends Form<Item>
Fall-through "transformation" between a structural Item and a nominal Item. Both mold(swim.structure.Item) and cast(swim.structure.Item) simply return the Item argument itself.
  • Constructor Details

    • ItemForm

      public ItemForm(Item unit)
  • Method Details

    • unit

      public Item unit()
      Description copied from class: Form
      Returns a default–possibly null–value of type T. Used as the fallback return value when coercing an invalid structural value.
      Overrides:
      unit in class Form<Item>
    • unit

      public Form<Item> unit(Item unit)
      Description copied from class: Form
      Returns a version of this Form with the given unit value.
      Overrides:
      unit in class Form<Item>
    • type

      public Class<Item> type()
      Description copied from class: Form
      Returns the reified Class of type T.
      Specified by:
      type in class Form<Item>
    • mold

      public Item mold(Item item)
      Description copied from class: Form
      Converts a nominally typed Java object into its structurally typed equivalent. The returned Item must never be null.
      Specified by:
      mold in class Form<Item>
    • cast

      public Item cast(Item item)
      Description copied from class: Form
      Converts a structurally typed item into a nominally typed Java object. The passed-in item is assumed to be non-null.
      Specified by:
      cast in class Form<Item>