/******************************************************************************* * Copyright (c) 2006-2010 eBay Inc. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 *******************************************************************************/ package org.ebayopensource.turmeric.runtime.common.binding; import org.ebayopensource.turmeric.runtime.common.exceptions.ServiceException; import org.ebayopensource.turmeric.runtime.common.pipeline.MessageContext; /** * @deprecated * This class provides functionality for converting between the default Java types * associated to JAXB serialization/deserialization, and any custom types needed * by the client or service. * * @author wdeng * * @param <ValueType> The Class of object to be returned in the deserialized Java bean. * @param <BoundType> The Class of object generated by deserializing the payload. */ public interface TypeConverter<ValueType, BoundType> { /** * This method is called after deserialization, to convert between the deserialized * value type and the desired bound (target) type. * @param ctx the message context for the current invocation * @param value the directly deserialized value type * @return a value of the target bound type * @throws ServiceException Exception when conversion fails. */ public BoundType postDeserializationConvert(MessageContext ctx, ValueType value) throws ServiceException; /** * This method is called before serialization, to convert between the bound (source) * type and the value type that will be directly serialized. * @param ctx the message context for the current invocation * @param value the source value in the bound type * @return the value ready to be serialized * @throws ServiceException Exception when conversion fails. */ public ValueType preSerializationConvert(MessageContext ctx, BoundType value) throws ServiceException; /** * Returns the value type for this type converter. * @return the value type */ public Class<ValueType> getValueType(); /** * Returns the bound type for this type converter. * @return the bound type */ public Class<BoundType> getBoundType(); }