Footer footer;
Iterator<Section> iter = payload.iterator();
List<Section> body = new ArrayList<Section>();
Section section = iter.hasNext() ? iter.next() : null;
if(section instanceof Header)
{
header = (Header) section;
section = iter.hasNext() ? iter.next() : null;
}
if(section instanceof DeliveryAnnotations)
{
section = iter.hasNext() ? iter.next() : null;
}
if(section instanceof MessageAnnotations)
{
messageAnnotations = (MessageAnnotations) section;
section = iter.hasNext() ? iter.next() : null;
}
if(section instanceof Properties)
{
properties = (Properties) section;
section = iter.hasNext() ? iter.next() : null;
}
if(section instanceof ApplicationProperties)
{
appProperties = (ApplicationProperties) section;
section = iter.hasNext() ? iter.next() : null;
}
while(section != null && !(section instanceof Footer))
{
body.add(section);
section = iter.hasNext() ? iter.next() : null;
}
footer = (Footer) section;
if(body.size() == 1)
{
Section bodySection = body.get(0);
if(bodySection instanceof AmqpValue && ((AmqpValue)bodySection).getValue() instanceof Map)
{
message = new MapMessageImpl(header, messageAnnotations, properties, appProperties, (Map) ((AmqpValue)bodySection).getValue(), footer, _session);
}
else if(bodySection instanceof AmqpValue && ((AmqpValue)bodySection).getValue() instanceof List)