net.sf.jsefa.xml.mapping
Class ElementMapping

java.lang.Object
  extended by net.sf.jsefa.common.mapping.NodeMapping<QName,T>
      extended by net.sf.jsefa.xml.mapping.XmlNodeMapping<ElementDescriptor>
          extended by net.sf.jsefa.xml.mapping.ElementMapping

public final class ElementMapping
extends XmlNodeMapping<ElementDescriptor>

A mapping between an XML element node and a java object. This mapping is used for serialization and deserialization.

Instances of this class are immutable and thread safe.

Author:
Norman Lahme-Huetig, Matthias Derer

Constructor Summary
ElementMapping(QName dataTypeName, ElementDescriptor elementDescriptor, Class<?> objectType, FieldDescriptor fieldDescriptor, Validator validator, boolean elementNameIsAmbiguous, TextMode textMode)
          Constructs a new ElementMapping.
 
Method Summary
 boolean elementNameIsAmbiguous()
           
 TextMode getTextMode()
           
 boolean isIndirectMapping()
          Signals if this is an indirect mapping.
 
Methods inherited from class net.sf.jsefa.common.mapping.NodeMapping
getDataTypeName, getFieldDescriptor, getNodeDescriptor, getObjectType, getValidator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElementMapping

public ElementMapping(QName dataTypeName,
                      ElementDescriptor elementDescriptor,
                      Class<?> objectType,
                      FieldDescriptor fieldDescriptor,
                      Validator validator,
                      boolean elementNameIsAmbiguous,
                      TextMode textMode)
Constructs a new ElementMapping.

Parameters:
dataTypeName - the name of the data type. This may be the data type name of the element node itself or of its implicit parent node.
elementDescriptor - the descriptor of the element
objectType - the type of the object. May be different from the object type contained in the field descriptor.
fieldDescriptor - the descriptor of the field
validator - the validator; may be null
elementNameIsAmbiguous - true, if the name of the element in its given context (position in the xml document) is ambiguous, i. e. there is sibling element with the same name; false otherwise.
textMode - defines the text mode in case of an element with text content (simple or not); may be null.
Method Detail

elementNameIsAmbiguous

public boolean elementNameIsAmbiguous()
Returns:
true, if the name of the element in its given context (position in the xml document) is ambiguous, i. e. there is sibling element with the same name; false otherwise.

getTextMode

public TextMode getTextMode()
Returns:
the text mode if this element allows for text content or null.

isIndirectMapping

public boolean isIndirectMapping()
Description copied from class: NodeMapping
Signals if this is an indirect mapping. This is the case if the data type name is not the one of this node but of its virtual parent node instead.

Overrides:
isIndirectMapping in class NodeMapping<QName,ElementDescriptor>
Returns:
true, if the data type name is not the same as the one of the element descriptor; false otherwise.


Copyright © 2014. All rights reserved.