Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.fasterxml.jackson.databind.jsontype.impl;
 
Partial base implementation of com.fasterxml.jackson.databind.jsontype.TypeIdResolver: all custom implementations are strongly recommended to extend this class, instead of directly implementing com.fasterxml.jackson.databind.jsontype.TypeIdResolver.

Note that instances created to be constructed from annotations (com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver) are always created using no-arguments constructor; protected constructor is only used sub-classes.

public abstract class TypeIdResolverBase
    implements TypeIdResolver
    protected final TypeFactory _typeFactory;

    
Common base type for all polymorphic instances handled.
    protected final JavaType _baseType;
    protected TypeIdResolverBase() {
        this(nullnull);
    }
    
    protected TypeIdResolverBase(JavaType baseTypeTypeFactory typeFactory)
    {
         = baseType;
         = typeFactory;
    }
    @Override
    public void init(JavaType bt) {
        // Standard type id resolvers do not need this: only useful for custom ones.
    }
    @Override
    public String idFromBaseType()
    {
        /* By default we will just defer to regular handling, handing out the
         * base type; and since there is no value, must just pass null here
         * assuming that implementations can deal with it.
         * Alternative would be to pass a bogus Object, but that does not seem right.
         */
        return idFromValueAndType(null.getRawClass());
    }

    

Deprecated:
Since 2.3, override typeFromId(com.fasterxml.jackson.databind.DatabindContext,java.lang.String) instead to get access to contextual information
    @Deprecated
    @Override
    public abstract JavaType typeFromId(String id);

    
New method, replacement for typeFromId(java.lang.String), which is given context for accessing information, including configuration and com.fasterxml.jackson.databind.type.TypeFactory.

Returns:
Type for given id
Since:
2.3
    public JavaType typeFromId(DatabindContext contextString id) {
        return typeFromId(id);
    }
New to GrepCode? Check out our FAQ X