001/* 002 * Copyright 2002-2016 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.jms.support.converter; 018 019import javax.jms.JMSException; 020import javax.jms.Message; 021import javax.jms.Session; 022 023/** 024 * An extended {@link MessageConverter} SPI with conversion hint support. 025 * 026 * <p>In case of a conversion hint being provided, the framework will call 027 * the extended method if a converter implements this interface, instead 028 * of calling the regular {@code toMessage} variant. 029 * 030 * @author Stephane Nicoll 031 * @since 4.3 032 */ 033public interface SmartMessageConverter extends MessageConverter { 034 035 /** 036 * A variant of {@link #toMessage(Object, Session)} which takes an extra conversion 037 * context as an argument, allowing to take e.g. annotations on a payload parameter 038 * into account. 039 * @param object the object to convert 040 * @param session the Session to use for creating a JMS Message 041 * @param conversionHint an extra object passed to the {@link MessageConverter}, 042 * e.g. the associated {@code MethodParameter} (may be {@code null}} 043 * @return the JMS Message 044 * @throws javax.jms.JMSException if thrown by JMS API methods 045 * @throws MessageConversionException in case of conversion failure 046 * @see #toMessage(Object, Session) 047 */ 048 Message toMessage(Object object, Session session, Object conversionHint) 049 throws JMSException, MessageConversionException; 050 051}