java.lang.Object
swim.structure.Form<T>
- Direct Known Subclasses:
ArrayForm,BigIntegerForm,BooleanForm,ByteBufferForm,ByteForm,CharacterForm,ClassForm,CollectionForm,DoubleForm,FieldForm,FloatForm,IntegerForm,ItemForm,LongForm,MapForm,NumberForm,PolyForm,R2Form,R3Form,ShortForm,StringForm,TagForm,TensorForm,UnitForm,UriForm,UriPathForm,UriPatternForm,ValueForm,Z2Form,Z3Form
Transformation between a structurally typed
Item and a nominally
typed Java object.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract TConverts a structurally typediteminto a nominally typed Java object.Converts a structurally typediteminto a nominally typed Java object based on the provided prototypeobject.static <T> Form<T>Utility method to construct anArrayForm.static final Form<BigInteger>Utility method to receive a singletonBigIntegerForm.Utility method to receive a singletonBooleanForm.static <T> Form<T>forBuiltin(Class<?> type) Returns thetypebuilt-inFormfortypeif it exists, andnullif it does not.forByte()Utility method to receive a singletonByteForm.static Form<ByteBuffer>Utility method to receive a singletonByteBufferForm.Utility method to receive a singletonCharacterForm.static <T> Form<T>static <T> Form<T>Returns aFormfortypeagainstscopepreferring built-inFormstoClassFormconstructions whenever possible.static <CC,T> Form<CC> forCollection(Class<?> type, Form<T> form) Utility method to construct aCollectionForm.Utility method to receive a singletonDoubleForm.forFloat()Utility method to receive a singletonFloatForm.Utility method to receive a singletonIntegerForm.forItem()Utility method to receive a singletonItemForm.Utility method to construct aCollectionFormwhere the underlying collection is of typeList<T>.forLong()Utility method to receive a singletonLongForm.static <CC,K, V> Form<CC> Utility method to construct aMapForm.Utility method to receive a singletonNumberForm.Utility method to construct aCollectionFormwhere the underlying collection is of typeList<T>.forShort()Utility method to receive a singletonShortForm.Utility method to receive a singletonStringForm.forValue()Utility method to receive a singletonValueForm.static booleanReturns whethertypehas a built-in base (i.e.abstract ItemConverts a nominally typed Javaobjectinto its structurally typed equivalent.Converts a nominally typed Javaobjectinto its structurally typed equivalent based on the provided prototypeitem.tag()Returns the key of the tag attribute that distinguishes structures of thisForm; returnsnullif thisFormhas no distinguishing tag attribute.abstract Class<?>type()Returns the reifiedClassof typeT.unit()Returns a default–possiblynull–value of typeT.Returns a version of thisFormwith the givenunitvalue.
-
Constructor Details
-
Form
public Form()
-
-
Method Details
-
tag
Returns the key of the tag attribute that distinguishes structures of thisForm; returnsnullif thisFormhas no distinguishing tag attribute. Used to accelerate distrcrimination of polymorphic structural types with nominal type hints. -
tag
-
unit
Returns a default–possiblynull–value of typeT. Used as the fallback return value whencoercingan invalid structural value. -
unit
Returns a version of thisFormwith the givenunitvalue. -
type
Returns the reifiedClassof typeT. -
mold
Converts a nominally typed Javaobjectinto its structurally typed equivalent based on the provided prototypeitem. The passed-initemis assumed to be non-null. The returnedItemmust never benull. -
mold
Converts a nominally typed Javaobjectinto its structurally typed equivalent. The returnedItemmust never benull. -
cast
Converts a structurally typediteminto a nominally typed Java object based on the provided prototypeobject. The passed-initemis assumed to be non-null. The passed-in prototypeobjectmay benull. -
cast
Converts a structurally typediteminto a nominally typed Java object. The passed-initemis assumed to be non-null. -
forByte
Utility method to receive a singletonByteForm. -
forShort
Utility method to receive a singletonShortForm. -
forInteger
Utility method to receive a singletonIntegerForm. -
forLong
Utility method to receive a singletonLongForm. -
forFloat
Utility method to receive a singletonFloatForm. -
forDouble
Utility method to receive a singletonDoubleForm. -
forCharacter
Utility method to receive a singletonCharacterForm. -
forBoolean
Utility method to receive a singletonBooleanForm. -
forBigInteger
Utility method to receive a singletonBigIntegerForm. -
forNumber
Utility method to receive a singletonNumberForm. -
forString
Utility method to receive a singletonStringForm. -
forByteBuffer
Utility method to receive a singletonByteBufferForm. -
forItem
Utility method to receive a singletonItemForm. -
forValue
Utility method to receive a singletonValueForm. -
forArray
Utility method to construct anArrayForm. -
forCollection
Utility method to construct aCollectionForm. -
forList
Utility method to construct aCollectionFormwhere the underlying collection is of typeList<T>. -
forSet
Utility method to construct aCollectionFormwhere the underlying collection is of typeList<T>. -
forMap
- Throws:
ClassCastException- iftypedoes not extendMap
-
forMap
Utility method to construct aMapForm. -
isBuiltin
Returns whethertypehas a built-in base (i.e. is defined inswim.structure.formand is not aCollectionForm)Form. -
forBuiltin
Returns thetypebuilt-inFormfortypeif it exists, andnullif it does not. -
forClass
Returns aFormfortypeagainstscopepreferring built-inFormstoClassFormconstructions whenever possible. -
forClass
-