net.sf.jsefa.common.mapping
Class MapTypeMapping<N,K extends NodeMapping<N,?>,D extends NodeDescriptor<?>,V extends NodeMapping<N,D>>

java.lang.Object
  extended by net.sf.jsefa.common.mapping.TypeMapping<N>
      extended by net.sf.jsefa.common.mapping.MapTypeMapping<N,K,D,V>
Type Parameters:
N - the type of the data type name
D - the type of the node descriptor
K - the type of the key node mapping
V - the type of the value node mapping
Direct Known Subclasses:
XmlMapTypeMapping

public abstract class MapTypeMapping<N,K extends NodeMapping<N,?>,D extends NodeDescriptor<?>,V extends NodeMapping<N,D>>
extends TypeMapping<N>

A mapping between a java map type and a map data type of the exchange format.

Author:
Norman Lahme-Huetig
See Also:
TypeMapping

Constructor Summary
MapTypeMapping(Class<?> objectType, N dataTypeName, K keyNodeMapping, Collection<V> valueNodeMappings, ObjectAccessor objectAccessor)
          Constructs a new MapTypeMapping.
 
Method Summary
protected  Map<D,V> createValueNodeMappingsByNodeDescriptorMap(Collection<V> nodeMappings)
          Creates a map of value node mappings by node descriptors.
 K getKeyNodeMapping()
           
 ObjectAccessor getObjectAccessor()
           
<T extends V>
T
getValueNodeMapping(Class<?> objectType)
          Returns the value node mapping for a map value object with the given object type.
<T extends V>
T
getValueNodeMapping(D nodeDescriptor)
          Returns the value node mapping for the given node descriptor.
 Collection<V> getValueNodeMappings()
           
 
Methods inherited from class net.sf.jsefa.common.mapping.TypeMapping
getDataTypeName, getObjectType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapTypeMapping

public MapTypeMapping(Class<?> objectType,
                      N dataTypeName,
                      K keyNodeMapping,
                      Collection<V> valueNodeMappings,
                      ObjectAccessor objectAccessor)
Constructs a new MapTypeMapping.

Parameters:
objectType - the object type
dataTypeName - the data type name
keyNodeMapping - the node mapping for the keys of the map
valueNodeMappings - the node mappings for the values of the map
objectAccessor - the object accessor
Method Detail

getKeyNodeMapping

public final K getKeyNodeMapping()
Returns:
the node mapping for the keys of the map.

getValueNodeMappings

public final Collection<V> getValueNodeMappings()
Returns:
the node mappings for the values of the map.

getValueNodeMapping

public <T extends V> T getValueNodeMapping(D nodeDescriptor)
Returns the value node mapping for the given node descriptor.

Type Parameters:
T - the expected type of the value node mapping
Parameters:
nodeDescriptor - the node descriptor
Returns:
the value node mapping

getValueNodeMapping

public <T extends V> T getValueNodeMapping(Class<?> objectType)
Returns the value node mapping for a map value object with the given object type. If none is registered for the object type the one for its super type is returned (and so on).

Type Parameters:
T - the expected type of the node mapping
Parameters:
objectType - the object type.
Returns:
the element mapping

getObjectAccessor

public final ObjectAccessor getObjectAccessor()
Returns:
the object accessor.

createValueNodeMappingsByNodeDescriptorMap

protected Map<D,V> createValueNodeMappingsByNodeDescriptorMap(Collection<V> nodeMappings)
Creates a map of value node mappings by node descriptors.

Parameters:
nodeMappings - the value node mappings for the map values
Returns:
a map of value node mappings by node descriptors


Copyright © 2014. All rights reserved.