Class FromProtobufTransformer
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.transformer.AbstractTransformer
org.springframework.integration.transformer.FromProtobufTransformer
- All Implemented Interfaces:
- Aware,- BeanClassLoaderAware,- BeanFactoryAware,- BeanNameAware,- InitializingBean,- ApplicationContextAware,- ExpressionCapable,- GenericTransformer<Message<?>,,- Message<?>> - NamedComponent,- Transformer
A Protocol Buffer transformer to instantiate 
Message objects
 from either byte[] if content type is application/x-protobuf
 or from String in case of application/json content type.- Since:
- 6.1
- Author:
- Christian Tzolov
- 
Field SummaryFields inherited from class org.springframework.integration.context.IntegrationObjectSupportEXPRESSION_PARSER, logger
- 
Constructor SummaryConstructorsConstructorDescriptionConstruct an instance with the supplied default type to create.FromProtobufTransformer(ProtobufMessageConverter protobufMessageConverter) Construct an instance with the supplied default type and ProtobufMessageConverter instance.
- 
Method SummaryModifier and TypeMethodDescriptionprotected ObjectdoTransform(Message<?> message) Subclasses must implement this method to provide the transformation logic.protected voidonInit()Subclasses may implement this for initialization logic.voidsetBeanClassLoader(ClassLoader classLoader) setExpectedType(Class<? extends com.google.protobuf.Message> expectedType) Set an expected protobuf class type.setExpectedTypeExpression(Expression expression) Set an expression to evaluate against the message to determine the type.setExpectedTypeExpressionString(String expression) Set an expression to evaluate against the message to determine the type id.Methods inherited from class org.springframework.integration.transformer.AbstractTransformertransformMethods inherited from class org.springframework.integration.context.IntegrationObjectSupportafterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getComponentType, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
- 
Constructor Details- 
FromProtobufTransformerpublic FromProtobufTransformer()Construct an instance with the supplied default type to create.
- 
FromProtobufTransformerConstruct an instance with the supplied default type and ProtobufMessageConverter instance.- Parameters:
- protobufMessageConverter- the message converter used.
 
 
- 
- 
Method Details- 
setBeanClassLoader- Specified by:
- setBeanClassLoaderin interface- BeanClassLoaderAware
 
- 
setExpectedTypepublic FromProtobufTransformer setExpectedType(Class<? extends com.google.protobuf.Message> expectedType) Set an expected protobuf class type. Mutually exclusive withsetExpectedTypeExpression(org.springframework.expression.Expression)andsetExpectedTypeExpressionString(java.lang.String).- Parameters:
- expectedType- expected protobuf class type.
- Returns:
- updated FromProtobufTransformer instance.
 
- 
setExpectedTypeExpressionStringSet an expression to evaluate against the message to determine the type id. Defaults toheaders['proto_type']. Mutually exclusive withsetExpectedType(java.lang.Class<? extends com.google.protobuf.Message>)andsetExpectedTypeExpression(org.springframework.expression.Expression).- Parameters:
- expression- the expression.
- Returns:
- updated FromProtobufTransformer instance.
 
- 
setExpectedTypeExpressionSet an expression to evaluate against the message to determine the type. Defaultheaders['proto_type']. Mutually exclusive withsetExpectedType(java.lang.Class<? extends com.google.protobuf.Message>)andsetExpectedTypeExpressionString(java.lang.String).- Parameters:
- expression- the expression.
- Returns:
- updated FromProtobufTransformer instance.
 
- 
onInitprotected void onInit()Description copied from class:IntegrationObjectSupportSubclasses may implement this for initialization logic.- Overrides:
- onInitin class- IntegrationObjectSupport
 
- 
doTransformDescription copied from class:AbstractTransformerSubclasses must implement this method to provide the transformation logic. If the return value is itself a Message, it will be used as the result. Otherwise, any non-null return value will be used as the payload of the result Message.- Specified by:
- doTransformin class- AbstractTransformer
- Parameters:
- message- The message.
- Returns:
- The result of the transformation.
 
 
-