Class TransformationClassSelector
java.lang.Object
org.chenile.core.interceptors.BaseChenileInterceptor
org.chenile.core.transform.TransformationClassSelector
- All Implemented Interfaces:
Command<ChenileExchange>
Selects the target Java type for the request body and stores it in
ChenileExchange.getBodyType() for the following Transformer interceptor.
Selection runs in this order:
- An operation-level body type selector, if configured.
- Otherwise, a service-level body type selector, if configured.
- Otherwise, the static operation and BODY parameter metadata, resolved by
setDefaultBodyType(ChenileExchange).
Type is kept in a
TypeReference so that parameterized request bodies, such as List<MyRequest>,
retain their element type through JSON conversion. A configured selector is responsible for
setting the exchange body type. The following Transformer uses this type to convert
raw JSON, decoded maps, decoded collections, and JSON nodes before service arguments are
bound. Already-compatible decoded values are preserved, and ordinary Java object bodies are
passed through unchanged.- Author:
- Raja Shankar Kolluru
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic tools.jackson.core.type.TypeReference<?> convertClassToTypeReference(Class<?> clazz) static tools.jackson.core.type.TypeReference<?> voiddoPreProcessing(ChenileExchange exchange) Override this to do pre-processing.private Command<ChenileExchange> obtainBodyTypeSelector(ChenileExchange exchange) private voidsetDefaultBodyType(ChenileExchange exchange) Methods inherited from class BaseChenileInterceptor
bypassInterception, doContinue, doPostProcessing, execute, getExtensionByAnnotation, getExtensionByAnnotation, resumeFromSavedPoint, savePoint
-
Constructor Details
-
TransformationClassSelector
public TransformationClassSelector()
-
-
Method Details
-
doPreProcessing
Description copied from class:BaseChenileInterceptorOverride this to do pre-processing. This will be called before the service is invoked. Don't expect to see exception or response being set inChenileExchange. However you can check forChenileExchange.getBody()to manipulate the body if this interceptor is a Chenile post processor or a service specific or operation specific interceptor.
If this interceptor is a Chenile pre-processor, thenChenileExchange.getBody()will return null. Then you need to look at headers only.- Overrides:
doPreProcessingin classBaseChenileInterceptor- Parameters:
exchange-
-
obtainBodyTypeSelector
-
setDefaultBodyType
-
convertClassToTypeReference
-
convertTypeToTypeReference
-
CHENILE