public Message toMessage(Object object, Session session) throws JMSException, MessageConversionException {
        Assert.state(object instanceof flex.messaging.messages.Message, "FlexMessageConverter can only handle Flex Messages");
        flex.messaging.messages.Message flexMessage = (flex.messaging.messages.Message) object;
        Object messageBody = flexMessage.getBody();
        Message jmsMessage = this.targetConverter.toMessage(messageBody, session);
        jmsMessage.setObjectProperty(FLEX_CLIENT_ID, flexMessage.getClientId());
        jmsMessage.setLongProperty(FLEX_TIME_TO_LIVE, flexMessage.getTimeToLive());
        Map<String, Object> headers = this.getFlexMessageHeaderMap(flexMessage);
        for (String key : headers.keySet()) {
            Object value = flexMessage.getHeader(key);
            try {
                jmsMessage.setObjectProperty(key, value);
            } catch (Exception e) {
                if (this.logger.isWarnEnabled()) {
                    this.logger.warn("failed to copy Flex header '" + key + "'", e);
                }
            }
        }
        return jmsMessage;
    }
public Message toMessage ( Object object , Session session ) throws JMSException , MessageConversionException { Assert . state ( object instanceof flex . messaging . messages . Message , "FlexMessageConverter can only handle Flex Messages" ) ; flex . messaging . messages . Message flexMessage = ( flex . messaging . messages . Message ) object ; Object messageBody = flexMessage . getBody ( ) ; Message jmsMessage = this . targetConverter . toMessage ( messageBody , session ) ; jmsMessage . setObjectProperty ( FLEX_CLIENT_ID , flexMessage . getClientId ( ) ) ; jmsMessage . setLongProperty ( FLEX_TIME_TO_LIVE , flexMessage . getTimeToLive ( ) ) ; Map < String , Object > headers = this . getFlexMessageHeaderMap ( flexMessage ) ; for ( String key : headers . keySet ( ) ) { Object value = flexMessage . getHeader ( key ) ; try { jmsMessage . setObjectProperty ( key , value ) ; } catch ( Exception e ) { if ( this . logger . isWarnEnabled ( ) ) { this . logger . warn ( "failed to copy Flex header '" + key + "'" , e ) ; } } } return jmsMessage ; }
{@inheritDoc}