java.lang.Object
swim.structure.Form<T>
swim.structure.form.ClassForm<T>
- All Implemented Interfaces:
Cloneable
For some
Class, a transformation between a structurally typed
Item and an instance of that Class.
A Class instance in Java can be completely described by its
Class name, its field names, and its field
values. This, combined with the fact that some fields are more
important than others, gives rise to the following rules for transforming
objects into structured Items:
- The String identifier for the
Class, usually simply theClassname or some function of it, is calledtag. - Every field being considered is either a
memberor aheader, with the latter reserved for "important" fields. - Every such field transforms to a
Slotwhose key is the name of the field and whose value is theItemrepresentation of the field. - The structural representation of every object is some
Recordunless the item isnull, which always transforms intoExtant. - The first entry in this
Recordis anAttrwhose key istagand whose value is either:- A
Recordofheadersthat were transformed intoSlotsvia rule 3., or Extantif thisClasshas no fields.
- A
- Every subsequent entry in the
Recordfrom rule 4. is amemberthat was transformed into aSlotvia rule 3.
These rules can be directly inverted to transform Items to objects.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionConverts a structurally typediteminto a nominally typed Java object.Converts a structurally typediteminto a nominally typed Java object based on the provided prototypeobject.clone()Converts 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.Class<?>type()Returns the reifiedClassof typeT.unit()Returns a default–possiblynull–value of typeT.Returns a version of thisFormwith the givenunitvalue.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
-
Constructor Details
-
ClassForm
-
-
Method Details
-
tag
Description copied from class:FormReturns 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
Description copied from class:Form -
unit
Description copied from class:FormReturns a default–possiblynull–value of typeT. Used as the fallback return value whencoercingan invalid structural value. -
unit
Description copied from class:FormReturns a version of thisFormwith the givenunitvalue. -
addHeader
-
putHeader
-
putHeader
-
putHeader
-
addMember
-
putMember
-
putMember
-
putMember
-
type
Description copied from class:FormReturns the reifiedClassof typeT. -
mold
Description copied from class:FormConverts 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
Description copied from class:FormConverts a nominally typed Javaobjectinto its structurally typed equivalent. The returnedItemmust never benull. -
cast
Description copied from class:FormConverts 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
Description copied from class:FormConverts a structurally typediteminto a nominally typed Java object. The passed-initemis assumed to be non-null. -
clone
-