Package io.github.astrapi69.model.util
Class MapModel<K,V>
- java.lang.Object
-
- io.github.astrapi69.model.GenericModel<T>
-
- io.github.astrapi69.model.util.GenericCollectionModel<java.util.Map<K,V>>
-
- io.github.astrapi69.model.util.MapModel<K,V>
-
- Type Parameters:
K
- map's key typeV
- map's value type
- All Implemented Interfaces:
Attachable
,IDetachable
,IModel<java.util.Map<K,V>>
,IObjectClassAwareModel<java.util.Map<K,V>>
,java.io.Serializable
public class MapModel<K,V> extends GenericCollectionModel<java.util.Map<K,V>>
Based onIModel
but for maps of serializable objects.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Map<K,V>
newSerializableCollectionOf(java.util.Map<K,V> object)
Creates a serializable version of the object.static <K,V>
IModel<java.util.Map<K,V>>ofMap(java.util.Map<K,V> map)
Factory method for models that contain maps.-
Methods inherited from class io.github.astrapi69.model.util.GenericCollectionModel
canEqual, equals, hashCode, setObject, toString
-
Methods inherited from class io.github.astrapi69.model.GenericModel
attach, detach, getObject, getObjectClass, ofCollection, ofList, ofSet
-
-
-
-
Method Detail
-
ofMap
public static <K,V> IModel<java.util.Map<K,V>> ofMap(java.util.Map<K,V> map)
Factory method for models that contain maps. This factory method will automatically rebuild a nonserializablemap
into a serializable one.- Type Parameters:
K
- key type in mapV
- value type in map- Parameters:
map
- The Map, which may or may not be Serializable- Returns:
- A IModel object wrapping the Map
-
newSerializableCollectionOf
protected java.util.Map<K,V> newSerializableCollectionOf(java.util.Map<K,V> object)
Creates a serializable version of the object. The object is usually a collection.- Specified by:
newSerializableCollectionOf
in classGenericCollectionModel<java.util.Map<K,V>>
- Parameters:
object
- the object- Returns:
- serializable version of
object
-
-