Class ValueForm

java.lang.Object
swim.structure.Form<Value>
swim.structure.form.ValueForm

public final class ValueForm extends Form<Value>
Fall-through transformation between a structurally typed Item and a structurally typed Value. mold(swim.structure.Value) simply returns the Value argument itself, and cast(swim.structure.Item) simply invokes Item.toValue() against the Item argument.
  • Constructor Details

    • ValueForm

      public ValueForm(Value unit)
  • Method Details

    • unit

      public Value 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<Value>
    • unit

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

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

      public Item mold(Value value)
      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<Value>
    • cast

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