use of com.fasterxml.jackson.databind.DeserializationConfig in project web3sdk by FISCO-BCOS.
the class ObjectMapperFactory method configureObjectMapper.
private static ObjectMapper configureObjectMapper(ObjectMapper objectMapper, boolean shouldIncludeRawResponses) {
if (shouldIncludeRawResponses) {
SimpleModule module = new SimpleModule();
module.setDeserializerModifier(new BeanDeserializerModifier() {
@Override
public JsonDeserializer<?> modifyDeserializer(DeserializationConfig config, BeanDescription beanDesc, JsonDeserializer<?> deserializer) {
if (Response.class.isAssignableFrom(beanDesc.getBeanClass())) {
return new RawResponseDeserializer(deserializer);
}
return deserializer;
}
});
objectMapper.registerModule(module);
}
objectMapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
return objectMapper;
}
use of com.fasterxml.jackson.databind.DeserializationConfig in project spring-boot by spring-projects.
the class JacksonAutoConfigurationTests method assertParameterNamesModuleCreatorBinding.
private void assertParameterNamesModuleCreatorBinding(Mode expectedMode, Class<?>... configClasses) {
this.contextRunner.withUserConfiguration(configClasses).run((context) -> {
DeserializationConfig deserializationConfig = context.getBean(ObjectMapper.class).getDeserializationConfig();
AnnotationIntrospector annotationIntrospector = deserializationConfig.getAnnotationIntrospector().allIntrospectors().iterator().next();
assertThat(annotationIntrospector).hasFieldOrPropertyWithValue("creatorBinding", expectedMode);
});
}
use of com.fasterxml.jackson.databind.DeserializationConfig in project Activiti by Activiti.
the class ProcessModelAutoConfiguration method customizeProcessModelObjectMapper.
// this bean will be automatically injected inside boot's ObjectMapper
@Bean
public Module customizeProcessModelObjectMapper() {
SimpleModule module = new SimpleModule("mapProcessModelInterfaces", Version.unknownVersion());
SimpleAbstractTypeResolver resolver = new SimpleAbstractTypeResolver() {
// this is a workaround for https://github.com/FasterXML/jackson-databind/issues/2019
// once version 2.9.6 is related we can remove this @override method
@Override
public JavaType resolveAbstractType(DeserializationConfig config, BeanDescription typeDesc) {
return findTypeMapping(config, typeDesc.getType());
}
};
resolver.addMapping(BPMNActivity.class, BPMNActivityImpl.class);
resolver.addMapping(ProcessInstance.class, ProcessInstanceImpl.class);
resolver.addMapping(ProcessDefinition.class, ProcessDefinitionImpl.class);
resolver.addMapping(BPMNSequenceFlow.class, BPMNSequenceFlowImpl.class);
resolver.addMapping(IntegrationContext.class, IntegrationContextImpl.class);
resolver.addMapping(BPMNSignal.class, BPMNSignalImpl.class);
resolver.addMapping(BPMNTimer.class, BPMNTimerImpl.class);
resolver.addMapping(BPMNMessage.class, BPMNMessageImpl.class);
resolver.addMapping(BPMNError.class, BPMNErrorImpl.class);
resolver.addMapping(MessageSubscription.class, MessageSubscriptionImpl.class);
resolver.addMapping(StartMessageSubscription.class, StartMessageSubscriptionImpl.class);
resolver.addMapping(StartMessageDeployedEvent.class, StartMessageDeployedEventImpl.class);
resolver.addMapping(StartMessageDeploymentDefinition.class, StartMessageDeploymentDefinitionImpl.class);
module.registerSubtypes(new NamedType(ProcessInstanceResult.class, ProcessInstanceResult.class.getSimpleName()));
module.registerSubtypes(new NamedType(DeleteProcessPayload.class, DeleteProcessPayload.class.getSimpleName()));
module.registerSubtypes(new NamedType(GetProcessDefinitionsPayload.class, GetProcessDefinitionsPayload.class.getSimpleName()));
module.registerSubtypes(new NamedType(GetProcessInstancesPayload.class, GetProcessInstancesPayload.class.getSimpleName()));
module.registerSubtypes(new NamedType(GetVariablesPayload.class, GetVariablesPayload.class.getSimpleName()));
module.registerSubtypes(new NamedType(RemoveProcessVariablesPayload.class, RemoveProcessVariablesPayload.class.getSimpleName()));
module.registerSubtypes(new NamedType(SetProcessVariablesPayload.class, SetProcessVariablesPayload.class.getSimpleName()));
module.registerSubtypes(new NamedType(SignalPayload.class, SignalPayload.class.getSimpleName()));
module.registerSubtypes(new NamedType(TimerPayload.class, TimerPayload.class.getSimpleName()));
module.registerSubtypes(new NamedType(StartProcessPayload.class, StartProcessPayload.class.getSimpleName()));
module.registerSubtypes(new NamedType(CreateProcessInstancePayload.class, CreateProcessInstancePayload.class.getSimpleName()));
module.registerSubtypes(new NamedType(SuspendProcessPayload.class, SuspendProcessPayload.class.getSimpleName()));
module.registerSubtypes(new NamedType(ResumeProcessPayload.class, ResumeProcessPayload.class.getSimpleName()));
module.registerSubtypes(new NamedType(UpdateProcessPayload.class, UpdateProcessPayload.class.getSimpleName()));
module.registerSubtypes(new NamedType(StartMessagePayload.class, StartMessagePayload.class.getSimpleName()));
module.registerSubtypes(new NamedType(ReceiveMessagePayload.class, ReceiveMessagePayload.class.getSimpleName()));
module.registerSubtypes(new NamedType(MessageEventPayload.class, MessageEventPayload.class.getSimpleName()));
module.setAbstractTypes(resolver);
return module;
}
use of com.fasterxml.jackson.databind.DeserializationConfig in project Activiti by Activiti.
the class TaskModelAutoConfiguration method customizeTaskModelObjectMapper.
// this bean will be automatically injected inside boot's ObjectMapper
@Bean
public Module customizeTaskModelObjectMapper() {
SimpleModule module = new SimpleModule("mapTaskRuntimeInterfaces", Version.unknownVersion());
SimpleAbstractTypeResolver resolver = new SimpleAbstractTypeResolver() {
// this is a workaround for https://github.com/FasterXML/jackson-databind/issues/2019
// once version 2.9.6 is related we can remove this @override method
@Override
public JavaType resolveAbstractType(DeserializationConfig config, BeanDescription typeDesc) {
return findTypeMapping(config, typeDesc.getType());
}
};
resolver.addMapping(Task.class, TaskImpl.class);
resolver.addMapping(TaskCandidateUser.class, TaskCandidateUserImpl.class);
resolver.addMapping(TaskCandidateGroup.class, TaskCandidateGroupImpl.class);
module.registerSubtypes(new NamedType(TaskResult.class, TaskResult.class.getSimpleName()));
module.registerSubtypes(new NamedType(ClaimTaskPayload.class, ClaimTaskPayload.class.getSimpleName()));
module.registerSubtypes(new NamedType(CompleteTaskPayload.class, CompleteTaskPayload.class.getSimpleName()));
module.registerSubtypes(new NamedType(SaveTaskPayload.class, SaveTaskPayload.class.getSimpleName()));
module.registerSubtypes(new NamedType(CreateTaskPayload.class, CreateTaskPayload.class.getSimpleName()));
module.registerSubtypes(new NamedType(DeleteTaskPayload.class, DeleteTaskPayload.class.getSimpleName()));
module.registerSubtypes(new NamedType(GetTasksPayload.class, GetTasksPayload.class.getSimpleName()));
module.registerSubtypes(new NamedType(GetTaskVariablesPayload.class, GetTaskVariablesPayload.class.getSimpleName()));
module.registerSubtypes(new NamedType(ReleaseTaskPayload.class, ReleaseTaskPayload.class.getSimpleName()));
module.registerSubtypes(new NamedType(UpdateTaskPayload.class, UpdateTaskPayload.class.getSimpleName()));
module.setAbstractTypes(resolver);
return module;
}
Aggregations