Annotation Interface JSONMapType


@Target({METHOD,FIELD}) @Retention(RUNTIME) public @interface JSONMapType
Provides a hint to the default deserializer that the generic types for a map-based collection that takes a two types (Maps).

Java's Generics are not reified as class data, and cannot be queried via reflection, hence why this hint exists.

If the type to deserialize to is an interface or abstract class, the following implementations are used for the underlying collection type (searched in this order):

  • SortedMap<K, V> - TreeMap
  • Map<K, V> - HashMap
If not a map, a JSONConversionException will occur.
Since:
1.1.0
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
     
     
  • Element Details

    • keyType

      Class<?> keyType
      Returns:
      the Generic type for the map key.
      Default:
      java.lang.String.class
    • valueType

      Class<?> valueType
      Returns:
      the Generic type for the map value.
      Default:
      com.blackrook.json.JSONObject.class