Class JsonSchemaResolver
java.lang.Object
org.apache.camel.component.jackson.transform.JsonSchemaResolver
- All Implemented Interfaces:
SchemaResolver
,org.apache.camel.Processor
public class JsonSchemaResolver
extends Object
implements SchemaResolver, org.apache.camel.Processor
Schema resolver able to read Json schema from given exchange being processed. First attempt is to retrieve the Json
schema reference from exchange properties. Second approach is to convert a given Json schema given as String in the
exchange properties to a proper schema object. Last approach it to load the Json schema as a classpath resource. The
following resource path is used to resolve the schema
classpath:schemas/json/<T>.json
where T represents the
content class name of the exchange body. The content class information is either set as an explicit exchange property
or it gets resolved from exchange body type information.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
process
(org.apache.camel.Exchange exchange) com.fasterxml.jackson.core.FormatSchema
resolve
(org.apache.camel.Exchange exchange) Resolves a schema for the given exchange.void
setContentClass
(String contentClass) void
-
Constructor Details
-
JsonSchemaResolver
public JsonSchemaResolver()
-
-
Method Details
-
getSchema
-
setSchema
-
getContentClass
-
setContentClass
-
process
- Specified by:
process
in interfaceorg.apache.camel.Processor
- Throws:
Exception
-
resolve
public com.fasterxml.jackson.core.FormatSchema resolve(org.apache.camel.Exchange exchange) Description copied from interface:SchemaResolver
Resolves a schema for the given exchange.- Specified by:
resolve
in interfaceSchemaResolver
- Parameters:
exchange
- the exchange for which the schema should be resolved- Returns:
- the resolved format or null if no format is found
-