Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.fasterxml.jackson.databind.jsontype.impl;
 
 
 
     extends ClassNameIdResolver
{
    
Package name of the base class, to be used for determining common prefix that can be omitted from included type id. Does not include the trailing dot.
    protected final String _basePackageName;

    
Same as _basePackageName, but includes trailing dot.
    protected final String _basePackagePrefix;
    
    protected MinimalClassNameIdResolver(JavaType baseTypeTypeFactory typeFactory)
    {
        super(baseTypetypeFactory);
        String base = baseType.getRawClass().getName();
        int ix = base.lastIndexOf('.');
        if (ix < 0) { // can this ever occur?
             = "";
             = ".";
        } else {
             = base.substring(0, ix+1);
             = base.substring(0, ix);
        }
    }
    @Override
    public JsonTypeInfo.Id getMechanism() { return ..; }
    
    @Override
    public String idFromValue(Object value)
    {
        String n = value.getClass().getName();
        if (n.startsWith()) {
            // note: we will leave the leading dot in there
            return n.substring(.length()-1);
        }
        return n;
    }
    @Override
    public JavaType typeFromId(String id)
    {
        if (id.startsWith(".")) {
            StringBuilder sb = new StringBuilder(id.length() + .length());
            if  (.length() == 0) {
                // no package; must remove leading '.' from id
                sb.append(id.substring(1));
            } else {
                // otherwise just concatenate package, with leading-dot-partial name
                sb.append().append(id);
            }
            id = sb.toString();
        }
        return super.typeFromId(id);
    }
New to GrepCode? Check out our FAQ X