List of usage examples for com.fasterxml.jackson.databind.jsontype TypeResolverBuilder typeProperty
public abstract T typeProperty(String paramString);
From source file:org.carewebframework.common.JSONUtil.java
/** * Initializes a mapper in a thread-safe way. * //from w w w.j a v a2 s . c o m * @return The initialized mapper. */ private static ObjectMapper initMapper(String typeProperty) { synchronized (mappers) { ObjectMapper mapper = mappers.get(typeProperty); if (mapper == null) { mapper = new ObjectMapper(); TypeResolverBuilder<?> typer = new CWTypeResolverBuilder(); typer = typer.init(JsonTypeInfo.Id.CUSTOM, new CWTypedIdResolver(mapper)); typer = typer.inclusion(JsonTypeInfo.As.PROPERTY); typer = typer.typeProperty(typeProperty); mapper.setDefaultTyping(typer); mappers.put(typeProperty, mapper); } return mapper; } }