net.sf.jsefa.common.mapping
Class ComplexTypeMapping<N,D extends NodeDescriptor<?>,M extends NodeMapping<N,?>>

java.lang.Object
  extended by net.sf.jsefa.common.mapping.TypeMapping<N>
      extended by net.sf.jsefa.common.mapping.ComplexTypeMapping<N,D,M>
Type Parameters:
N - the type of the data type name
D - the type of the node descriptor
M - the type of the node mapping
Direct Known Subclasses:
RbfComplexTypeMapping, XmlComplexTypeMapping

public abstract class ComplexTypeMapping<N,D extends NodeDescriptor<?>,M extends NodeMapping<N,?>>
extends TypeMapping<N>

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

Author:
Norman Lahme-Huetig
See Also:
TypeMapping

Constructor Summary
ComplexTypeMapping(Class<?> objectType, N dataTypeName, Collection<M> nodeMappings, ObjectAccessor objectAccessor, Validator validator)
          Constructs a new ComplexTypeMapping.
 
Method Summary
protected  Map<D,M> createNodeMappingsByNodeDescriptorMap(Collection<M> nodeMappings)
          Creates a map of node mappings by node descriptors.
 List<String> getFieldNames(NodeType nodeType)
          Returns the names of all fields which map to a node of the given node type.
<T extends M>
T
getNodeMapping(D nodeDescriptor)
          Returns the node mapping for the given node descriptor.
<T extends M>
T
getNodeMapping(String fieldName, Class<?> objectType)
          Returns the node mapping for the given field name and required object type of the field.
 Collection<M> getNodeMappings()
           
 ObjectAccessor getObjectAccessor()
           
 Validator getValidator()
           
 
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

ComplexTypeMapping

public ComplexTypeMapping(Class<?> objectType,
                          N dataTypeName,
                          Collection<M> nodeMappings,
                          ObjectAccessor objectAccessor,
                          Validator validator)
Constructs a new ComplexTypeMapping.

Parameters:
objectType - the object type.
dataTypeName - the data type name.
nodeMappings - the node mappings
objectAccessor - the object accessor
validator - the validator - may be null
Method Detail

getNodeMappings

public final Collection<M> getNodeMappings()
Returns:
the node mappings.

getNodeMapping

public <T extends M> T getNodeMapping(D nodeDescriptor)
Returns the node mapping for the given node descriptor.

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

getNodeMapping

public <T extends M> T getNodeMapping(String fieldName,
                                      Class<?> objectType)
Returns the node mapping for the given field name and required object type of the field.

Type Parameters:
T - the expected type of the node mapping
Parameters:
fieldName - the field name
objectType - the required object type of the field
Returns:
the node mapping

getFieldNames

public List<String> getFieldNames(NodeType nodeType)
Returns the names of all fields which map to a node of the given node type.

Parameters:
nodeType - the node type
Returns:
the list of fields (the order does matter).

getObjectAccessor

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

getValidator

public final Validator getValidator()
Returns:
the validator - may be null

createNodeMappingsByNodeDescriptorMap

protected Map<D,M> createNodeMappingsByNodeDescriptorMap(Collection<M> nodeMappings)
Creates a map of node mappings by node descriptors.

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


Copyright © 2014. All rights reserved.