- java.lang.Object
-
- swim.structure.Form<T>
-
- swim.structure.form.UnitForm<T>
-
public final class UnitForm<T> extends Form<T>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
cast(Item item)
Converts a structurally typeditem
into a nominally typed Java object.T
cast(Item item, T object)
Converts a structurally typeditem
into a nominally typed Java object based on the provided prototypeobject
.Item
mold(T object)
Converts a nominally typed Javaobject
into its structurally typed equivalent.Item
mold(T object, Item item)
Converts a nominally typed Javaobject
into its structurally typed equivalent based on the provided prototypeitem
.String
tag()
Returns the key of the tag attribute that distinguishes structures of thisForm
; returnsnull
if thisForm
has no distinguishing tag attribute.Form<T>
tag(String tag)
Class<?>
type()
Returns the reifiedClass
of typeT
.T
unit()
Returns a default–possiblynull
–value of typeT
.Form<T>
unit(T unit)
Returns a version of thisForm
with the givenunit
value.-
Methods inherited from class swim.structure.Form
forArray, forBigInteger, forBoolean, forBuiltin, forByte, forByteBuffer, forCharacter, forClass, forClass, forCollection, forDouble, forFloat, forInteger, forItem, forList, forLong, forMap, forMap, forNumber, forSet, forShort, forString, forValue, isBuiltin
-
-
-
-
Method Detail
-
tag
public String tag()
Description copied from class:Form
Returns the key of the tag attribute that distinguishes structures of thisForm
; returnsnull
if thisForm
has no distinguishing tag attribute. Used to accelerate distrcrimination of polymorphic structural types with nominal type hints.
-
unit
public T 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<T> unit(T unit)
Description copied from class:Form
Returns a version of thisForm
with the givenunit
value.
-
type
public Class<?> type()
Description copied from class:Form
Returns the reifiedClass
of typeT
.
-
mold
public Item mold(T object, Item item)
Description copied from class:Form
Converts a nominally typed Javaobject
into its structurally typed equivalent based on the provided prototypeitem
. The passed-initem
is assumed to be non-null
. The returnedItem
must never benull
.
-
mold
public Item mold(T object)
Description copied from class:Form
Converts a nominally typed Javaobject
into its structurally typed equivalent. The returnedItem
must never benull
.
-
cast
public T cast(Item item, T object)
Description copied from class:Form
Converts a structurally typeditem
into a nominally typed Java object based on the provided prototypeobject
. The passed-initem
is assumed to be non-null
. The passed-in prototypeobject
may benull
.
-
-