Example usage for com.fasterxml.jackson.databind ObjectMapper canDeserialize

List of usage examples for com.fasterxml.jackson.databind ObjectMapper canDeserialize

Introduction

In this page you can find the example usage for com.fasterxml.jackson.databind ObjectMapper canDeserialize.

Prototype

public boolean canDeserialize(JavaType type) 

Source Link

Document

Method that can be called to check whether mapper thinks it could deserialize an Object of given type.

Usage

From source file:org.smartdeveloperhub.vocabulary.config.ConfigurationFactory.java

static <T> T convert(final Object source, final Type type) {
    final ObjectMapper mapper = parsingMapper();
    final JavaType constructType = mapper.getTypeFactory().constructType(type);
    checkArgument(mapper.canDeserialize(constructType), "%s is not a valid configuration class",
            constructType.toCanonical());
    return mapper.convertValue(source, constructType);
}