com.openharbor.beck.configure
Class MappingMapper

java.lang.Object
  extended bycom.openharbor.beck.map.DefaultMapper
      extended bycom.openharbor.beck.configure.MappingMapper
All Implemented Interfaces:
MapFromXML, MapToXML, Prefixer

public class MappingMapper
extends DefaultMapper

For directions, see Configuration.MAP_FROM_XML. This is class is required to be thread-safe (unlike DefaultMapper), to support concurrent usage of Configuration.MAP_FROM_XML. The authors have tried to make this class thread-safe, but it's possible they've failed.


Nested Class Summary
 
Nested classes inherited from class com.openharbor.beck.map.MapFromXML
MapFromXML.Aware, MapFromXML.Source
 
Nested classes inherited from class com.openharbor.beck.map.MapToXML
MapToXML.Source
 
Field Summary
protected  ObjectFactory factory
           
 
Fields inherited from class com.openharbor.beck.map.DefaultMapper
arrayMarshaller, CLASS_TO_PROPERTY_TO_SETTER, class2property2setter, collectionMarshaller, configurationMemo, dateMarshaller, defaultMarshaller, globalSelector, listMarshaller, log, mapMarshaller, marshalSelector, primitiveMarshaller, primitiveUnmarshallers, PROPERTIES, singletons, stringMarshaller, unmarshallerClass2Pool, unmarshalSelector
 
Constructor Summary
MappingMapper()
           
 
Method Summary
 Identifier getIdentifier(Unmarshaller parent, XMLThing source, java.lang.Class objectClass)
           
 java.lang.Class getObjectClass(Unmarshaller parent, XMLThing source)
          Choose the Java class for an XML attribute or element.
 java.lang.String getPropertyName(Unmarshaller parent, XMLThing source)
          Choose the JavaBean property name for an XML attribute or element.
 Setter getSetter(Unmarshaller parent, XMLThing source, Unmarshaller child)
          Choose the algorithm for creating a reference from a parent object to a child object.
 java.lang.String getText(Unmarshaller parent)
          Choose the Java property to be copied from XML text.
 Unmarshaller getUnmarshaller(Unmarshaller parent, XMLThing source, XMLContext context)
          Engage an unmarshaller for the given XML source.
 java.lang.Object newObject(Unmarshaller unmarshaller)
          Instantiate an object for the given unmarshaller.
 XMLReceiver newReceiver(XMLThing source)
           
 void recycle(Unmarshaller unmarshaller)
          Make a Unmarshaller available for serial re-use.
 
Methods inherited from class com.openharbor.beck.map.DefaultMapper
add, addDefault, addType, allocateUnmarshaller, configure, configureUnmarshaller, findConfiguredSetters, findDefaultSetters, findNonPublicSetterFields, findNonPublicSetterMethods, findNonPublicSetters, findPublicSetterFields, findPublicSetterMethods, findPublicSetters, getConfiguration, getConfigurationValue, getConfiguredSetter, getConfiguredSetter, getConfiguredUnmarshaller, getDefaultSetter, getGetter, getGetter, getIdentifier, getList, getMap, getMarshaller, getNamer, getParentElement, getPrefix, getPrefixer, getProperties, getProperties, getSelector, getSignificantPart, getSingleton, getSourceClass, getText, getXML, newContentHandler, newErrorHandler, newInstance, newInstance, newInstance, putUnmarshaller, subtract
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factory

protected final ObjectFactory factory
Constructor Detail

MappingMapper

public MappingMapper()
Method Detail

newReceiver

public XMLReceiver newReceiver(XMLThing source)
Specified by:
newReceiver in interface MapFromXML
Overrides:
newReceiver in class DefaultMapper

getObjectClass

public java.lang.Class getObjectClass(Unmarshaller parent,
                                      XMLThing source)
Description copied from interface: MapFromXML
Choose the Java class for an XML attribute or element.

Specified by:
getObjectClass in interface MapFromXML
Overrides:
getObjectClass in class DefaultMapper

getPropertyName

public java.lang.String getPropertyName(Unmarshaller parent,
                                        XMLThing source)
Description copied from interface: MapFromXML
Choose the JavaBean property name for an XML attribute or element.

Specified by:
getPropertyName in interface MapFromXML
Overrides:
getPropertyName in class DefaultMapper

getText

public java.lang.String getText(Unmarshaller parent)
Description copied from interface: MapFromXML
Choose the Java property to be copied from XML text.

Specified by:
getText in interface MapFromXML
Overrides:
getText in class DefaultMapper

getSetter

public Setter getSetter(Unmarshaller parent,
                        XMLThing source,
                        Unmarshaller child)
Description copied from interface: MapFromXML
Choose the algorithm for creating a reference from a parent object to a child object. For example, setting a field or property of the parent, to refer to the child.

Specified by:
getSetter in interface MapFromXML
Overrides:
getSetter in class DefaultMapper

newObject

public java.lang.Object newObject(Unmarshaller unmarshaller)
                           throws java.lang.Exception
Description copied from interface: MapFromXML
Instantiate an object for the given unmarshaller. The returned object should be assignable to unmarshaller.getObjectClass().

Specified by:
newObject in interface MapFromXML
Overrides:
newObject in class DefaultMapper
Throws:
java.lang.Exception

getUnmarshaller

public Unmarshaller getUnmarshaller(Unmarshaller parent,
                                    XMLThing source,
                                    XMLContext context)
Description copied from interface: MapFromXML
Engage an unmarshaller for the given XML source. For best performance, the returned unmarshaller should be passed to MapFromXML.putUnmarshaller(com.openharbor.beck.unmarshal.Unmarshaller) after it has processed the XML source.

Specified by:
getUnmarshaller in interface MapFromXML
Overrides:
getUnmarshaller in class DefaultMapper

recycle

public void recycle(Unmarshaller unmarshaller)
             throws java.lang.Exception
Description copied from interface: MapFromXML
Make a Unmarshaller available for serial re-use. This enables a performance optimization: recycyling a Unmarshaller avoids the cost of constructing a new one. This method presumes that all unmarshallers of the same class are fungible. That is, getUnmarshaller may re-use the given unmarshaller instead of any new instance of unmarshaller.getClass().

Specified by:
recycle in interface MapFromXML
Overrides:
recycle in class DefaultMapper
Throws:
java.lang.Exception

getIdentifier

public Identifier getIdentifier(Unmarshaller parent,
                                XMLThing source,
                                java.lang.Class objectClass)
Specified by:
getIdentifier in interface MapFromXML
Overrides:
getIdentifier in class DefaultMapper