public <T> T readPayloadAsJAXB(Bridge<T> bridge) throws JAXBException {
   cacheMessage();
   if (!hasPayload()) {
     return null;
   }
   assert unconsumed();
   T r =
       bridge.unmarshal(
           reader, hasAttachments() ? new AttachmentUnmarshallerImpl(getAttachments()) : null);
   XMLStreamReaderUtil.close(reader);
   XMLStreamReaderFactory.recycle(reader);
   return r;
 }