- java.lang.Object
-
- swim.structure.Form<Value>
-
- swim.structure.form.ValueForm
-
public final class ValueForm extends Form<Value>
Fall-through transformation between a structurally typedItem
and a structurally typedValue
.mold(swim.structure.Value)
simply returns theValue
argument itself, andcast(swim.structure.Item)
simply invokesItem.toValue()
against theItem
argument.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Value
cast(Item item)
Converts a structurally typeditem
into a nominally typed Java object.Item
mold(Value value)
Converts a nominally typed Javaobject
into its structurally typed equivalent.Class<Value>
type()
Returns the reifiedClass
of typeT
.Value
unit()
Returns a default–possiblynull
–value of typeT
.Form<Value>
unit(Value unit)
Returns a version of thisForm
with the givenunit
value.-
Methods inherited from class swim.structure.Form
cast, forArray, forBigInteger, forBoolean, forBuiltin, forByte, forByteBuffer, forCharacter, forClass, forClass, forCollection, forDouble, forFloat, forInteger, forItem, forList, forLong, forMap, forMap, forNumber, forSet, forShort, forString, forValue, isBuiltin, mold, tag, tag
-
-
-
-
Constructor Detail
-
ValueForm
public ValueForm(Value unit)
-
-
Method Detail
-
unit
public Value unit()
Description copied from class:Form
Returns a default–possiblynull
–value of typeT
. Used as the fallback return value whencoercing
an invalid structural value.
-
unit
public Form<Value> unit(Value unit)
Description copied from class:Form
Returns a version of thisForm
with the givenunit
value.
-
type
public Class<Value> type()
Description copied from class:Form
Returns the reifiedClass
of typeT
.
-
mold
public Item mold(Value value)
Description copied from class:Form
Converts a nominally typed Javaobject
into its structurally typed equivalent. The returnedItem
must never benull
.
-
-