- java.lang.Object
-
- swim.structure.Form<Object>
-
- swim.structure.form.PolyForm
-
-
Constructor Summary
Constructors Constructor Description PolyForm()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PolyForm
addClass(Class<?> newClass)
PolyForm
addClasses(Class<?>... newClasses)
PolyForm
addForm(Form<?> newForm)
PolyForm
addForms(Form<?>... newForms)
PolyForm
addType(Type genericType)
PolyForm
addTypes(Type... newGenericTypes)
Object
cast(Item item)
Converts a structurally typeditem
into a nominally typed Java object.Object
cast(Item item, Object object)
Converts a structurally typeditem
into a nominally typed Java object based on the provided prototypeobject
.protected Object
castBool(Bool value)
protected Object
castData(Data value)
protected Object
castNum(Num value)
protected Object
castRecord(Record value)
protected Object
castRecord(Record value, Object object)
protected Object
castText(Text value)
PolyForm
clone()
<T> Form<T>
formForClass(Class<?> type)
<T> Form<T>
formForTag(String tag)
<T> Form<T>
formForType(Type genericType)
Item
mold(Object object)
Converts a nominally typed Javaobject
into its structurally typed equivalent.Item
mold(Object object, Item item)
Converts a nominally typed Javaobject
into its structurally typed equivalent based on the provided prototypeitem
.protected Item
moldArray(Object[] object)
protected Item
moldArray(Object[] object, Item item)
protected Item
moldBoolean(Boolean object)
protected Item
moldBoolean(Boolean object, Item item)
protected Item
moldByteBuffer(ByteBuffer object)
protected Item
moldByteBuffer(ByteBuffer object, Item item)
protected Item
moldCharacter(Character object)
protected Item
moldCharacter(Character object, Item item)
protected Item
moldCollection(Collection<?> object)
protected Item
moldCollection(Collection<?> object, Item item)
protected Item
moldMap(Map<?,?> object)
protected Item
moldMap(Map<?,?> object, Item item)
protected Item
moldNumber(Number object)
protected Item
moldNumber(Number object, Item item)
protected Item
moldString(String object)
protected Item
moldString(String object, Item item)
<T> Form<T>
reflectClass(Class<?> type)
<T> ClassForm<T>
reflectClassForm(Class<?> type)
<T> ClassForm<T>
reflectClassForm(Class<?> type, String tag)
<T> ClassForm<T>
reflectClassForm(Class<?> type, String tag, T unit)
<T> ClassForm<T>
reflectClassForm(ClassForm<T> classForm)
<T> Form<T>
reflectClassName(String className)
String
reflectClassTag(Class<?> type)
<T> ClassForm<T>
reflectField(ClassForm<T> classForm, Field field)
<T> ClassForm<T>
reflectFields(ClassForm<T> classForm, Class<?> type)
Class<?>
type()
Returns the reifiedClass
of typeT
.Object
unit()
Returns a default–possiblynull
–value of typeT
.PolyForm
unit(Object 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, tag, tag
-
-
-
-
Method Detail
-
unit
public final Object 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 PolyForm unit(Object unit)
Description copied from class:Form
Returns a version of thisForm
with the givenunit
value.
-
type
public final Class<?> type()
Description copied from class:Form
Returns the reifiedClass
of typeT
.
-
mold
public Item mold(Object 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(Object object)
Description copied from class:Form
Converts a nominally typed Javaobject
into its structurally typed equivalent. The returnedItem
must never benull
.
-
moldByteBuffer
protected Item moldByteBuffer(ByteBuffer object, Item item)
-
moldByteBuffer
protected Item moldByteBuffer(ByteBuffer object)
-
moldCollection
protected Item moldCollection(Collection<?> object, Item item)
-
moldCollection
protected Item moldCollection(Collection<?> object)
-
cast
public Object cast(Item item, Object 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
.
-
cast
public Object cast(Item item)
Description copied from class:Form
Converts a structurally typeditem
into a nominally typed Java object. The passed-initem
is assumed to be non-null
.
-
-