Class PolyForm

java.lang.Object
swim.structure.Form<Object>
swim.structure.form.PolyForm
All Implemented Interfaces:
Cloneable

public class PolyForm extends Form<Object> implements Cloneable
  • Constructor Details

    • PolyForm

      public PolyForm()
  • Method Details

    • unit

      public final Object unit()
      Description copied from class: Form
      Returns a default–possibly null–value of type T. Used as the fallback return value when coercing an invalid structural value.
      Overrides:
      unit in class Form<Object>
    • unit

      public PolyForm unit(Object unit)
      Description copied from class: Form
      Returns a version of this Form with the given unit value.
      Overrides:
      unit in class Form<Object>
    • type

      public final Class<?> type()
      Description copied from class: Form
      Returns the reified Class of type T.
      Specified by:
      type in class Form<Object>
    • mold

      public Item mold(Object object, Item item)
      Description copied from class: Form
      Converts a nominally typed Java object into its structurally typed equivalent based on the provided prototype item. The passed-in item is assumed to be non-null. The returned Item must never be null.
      Overrides:
      mold in class Form<Object>
    • mold

      public Item mold(Object object)
      Description copied from class: Form
      Converts a nominally typed Java object into its structurally typed equivalent. The returned Item must never be null.
      Specified by:
      mold in class Form<Object>
    • moldString

      protected Item moldString(String object, Item item)
    • moldString

      protected Item moldString(String object)
    • moldNumber

      protected Item moldNumber(Number object, Item item)
    • moldNumber

      protected Item moldNumber(Number object)
    • moldCharacter

      protected Item moldCharacter(Character object, Item item)
    • moldCharacter

      protected Item moldCharacter(Character object)
    • moldBoolean

      protected Item moldBoolean(Boolean object, Item item)
    • moldBoolean

      protected Item moldBoolean(Boolean object)
    • moldByteBuffer

      protected Item moldByteBuffer(ByteBuffer object, Item item)
    • moldByteBuffer

      protected Item moldByteBuffer(ByteBuffer object)
    • moldArray

      protected Item moldArray(Object[] object, Item item)
    • moldArray

      protected Item moldArray(Object[] object)
    • moldCollection

      protected Item moldCollection(Collection<?> object, Item item)
    • moldCollection

      protected Item moldCollection(Collection<?> object)
    • moldMap

      protected Item moldMap(Map<?,?> object, Item item)
    • moldMap

      protected Item moldMap(Map<?,?> object)
    • cast

      public Object cast(Item item, Object object)
      Description copied from class: Form
      Converts a structurally typed item into a nominally typed Java object based on the provided prototype object. The passed-in item is assumed to be non-null. The passed-in prototype object may be null.
      Overrides:
      cast in class Form<Object>
    • cast

      public Object cast(Item item)
      Description copied from class: Form
      Converts a structurally typed item into a nominally typed Java object. The passed-in item is assumed to be non-null.
      Specified by:
      cast in class Form<Object>
    • castRecord

      protected Object castRecord(Record value, Object object)
    • castRecord

      protected Object castRecord(Record value)
    • castText

      protected Object castText(Text value)
    • castData

      protected Object castData(Data value)
    • castNum

      protected Object castNum(Num value)
    • castBool

      protected Object castBool(Bool value)
    • formForTag

      public <T> Form<T> formForTag(String tag)
    • formForClass

      public <T> Form<T> formForClass(Class<?> type)
    • formForType

      public <T> Form<T> formForType(Type genericType)
    • addForm

      public PolyForm addForm(Form<?> newForm)
    • addForms

      public PolyForm addForms(Form<?>... newForms)
    • addClass

      public PolyForm addClass(Class<?> newClass)
    • addClasses

      public PolyForm addClasses(Class<?>... newClasses)
    • addType

      public PolyForm addType(Type genericType)
    • addTypes

      public PolyForm addTypes(Type... newGenericTypes)
    • reflectClassForm

      public <T> ClassForm<T> reflectClassForm(ClassForm<T> classForm)
    • reflectClassForm

      public <T> ClassForm<T> reflectClassForm(Class<?> type, String tag, T unit)
    • reflectClassForm

      public <T> ClassForm<T> reflectClassForm(Class<?> type, String tag)
    • reflectClassForm

      public <T> ClassForm<T> reflectClassForm(Class<?> type)
    • reflectClass

      public <T> Form<T> reflectClass(Class<?> type)
    • reflectClassName

      public <T> Form<T> reflectClassName(String className)
    • reflectClassTag

      public String reflectClassTag(Class<?> type)
    • reflectField

      public <T> ClassForm<T> reflectField(ClassForm<T> classForm, Field field)
    • reflectFields

      public <T> ClassForm<T> reflectFields(ClassForm<T> classForm, Class<?> type)
    • clone

      public PolyForm clone()
      Overrides:
      clone in class Object