Class ArrayForm

java.lang.Object
swim.structure.Form<Object>
swim.structure.form.ArrayForm

public final class ArrayForm extends Form<Object>
For some type, a transformation between a structurally typed Item and an array of elements with that type.
  • Constructor Details

    • ArrayForm

      public ArrayForm(Class<?> type, Form<?> form)
      Parameters:
      type - the Class to which elements of the desired arrays belong
      form - the desired Form that transforms instances of type
  • Method Details

    • unit

      public Object 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<Object>
    • type

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

      public Item mold(Object array, Item item)
      Description copied from class: Form
      Converts a nominally typed Java object into its structurally typed equivalent based on the provided prototype item. The passed-in item is assumed to be non-null. The returned Item must never be null.
      Overrides:
      mold in class Form<Object>
    • mold

      public Item mold(Object array)
      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<Object>
    • cast

      public Object 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<Object>