Class MapForm<K,​V>


  • public final class MapForm<K,​V>
    extends Form<Map<K,​V>>
    For some Map<K,V>, a transformation between a structurally typed Item and an instance of that Map.
    • Constructor Detail

      • MapForm

        public MapForm​(Class<?> type,
                       Form<K> keyForm,
                       Form<V> valForm)
    • Method Detail

      • unit

        public Map<K,​V> 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<Map<K,​V>>
      • type

        public Class<?> type()
        Description copied from class: Form
        Returns the reified Class of type T.
        Specified by:
        type in class Form<Map<K,​V>>
      • mold

        public Item mold​(Map<K,​V> map,
                         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<Map<K,​V>>
      • mold

        public Item mold​(Map<K,​V> map)
        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<Map<K,​V>>
      • cast

        public Map<K,​V> cast​(Item item,
                                   Map<K,​V> map)
        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<Map<K,​V>>
      • cast

        public Map<K,​V> 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<Map<K,​V>>