// Process only if there is no script.
if (mapping.getOrdinal() == 0)
{
EndpointPart srcPart = source.getPart();
EndpointPart dstPart = mapping.getDestination(mapping.getDestinationCount() - 1);
Message message = null;
boolean bParse = false;
// Handle ref -> primitive and primitive -> ref.
if (srcPart instanceof CompositeMessagePartRef && dstPart.isPrimitive())
{
message = m_context.getMetadata().getMessage(((CompositeMessagePartRef)srcPart).getRefPart().getName());
}
else if (dstPart instanceof CompositeMessagePartRef && srcPart.isPrimitive())
{
message = m_context.getMetadata().getMessage(((CompositeMessagePartRef)dstPart).getRefPart().getName());
bParse = true;
}
if (message != null && message.getFormat() != null)
{
if (bParse)
{
Input in = new ObjectInput(value);
MessageParser parser;
if (m_parserMap == null)
{
m_parserMap = new HashTab(m_context.getMetadata().getFormatCount());
}
parser = (MessageParser)m_parserMap.get(message.getFormat());
if (parser == null)
{
parser = (MessageParser)message.getFormat().getParser().getInstance(m_context);
m_parserMap.put(message.getFormat(), parser);
}
value = parser.parse(in, message);
}
else
{
ObjectOutput out = new ObjectOutput();
MessageFormatter formatter;
if (m_formatterMap == null)
{
m_formatterMap = new HashTab(m_context.getMetadata().getFormatCount());
}
formatter = (MessageFormatter)m_formatterMap.get(message.getFormat());
if (formatter == null)
{
formatter = (MessageFormatter)message.getFormat().getFormatter().getInstance(m_context);
m_formatterMap.put(message.getFormat(), formatter);
}
formatter.format((TransferObject)value, message, out);
value = out.getObject();
}