Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.fasterxml.jackson.databind.type;
  
  
 
 public abstract class TypeBase
     extends JavaType
     implements JsonSerializable
 {
     private static final long serialVersionUID = -3581199092426900829L;

    
Lazily initialized external representation of the type
 
     volatile transient String _canonicalName;

    

Deprecated:
Since 2.2 use method that takes 'asStatic' argument
 
     @Deprecated
     protected TypeBase(Class<?> rawint hash,
             Object valueHandlerObject typeHandler)
     {
         this(rawhashvalueHandlertypeHandlerfalse);
     }

    
Main constructor to use by extending classes.
 
     protected TypeBase(Class<?> rawint hash,
             Object valueHandlerObject typeHandlerboolean asStatic)
     {
         super(rawhashvalueHandlertypeHandlerasStatic);
     }
 
     @Override
     public String toCanonical()
     {
         String str = ;
         if (str == null) {
             str = buildCanonicalName();
         }
         return str;
     }
     
     protected abstract String buildCanonicalName();
 
     @Override
     public abstract StringBuilder getGenericSignature(StringBuilder sb);
 
     @Override
     public abstract StringBuilder getErasedSignature(StringBuilder sb);
 
     @Override
     @SuppressWarnings("unchecked")
     public <T> T getValueHandler() { return (T) ; }
 
     @Override
     @SuppressWarnings("unchecked")
     public <T> T getTypeHandler() { return (T) ; }
     
     /*
     /**********************************************************
     /* JsonSerializableWithType base implementation
     /**********************************************************
      */
 
     @Override
     public void serializeWithType(JsonGenerator jgenSerializerProvider provider,
             TypeSerializer typeSer)
         throws IOExceptionJsonProcessingException
     {
         typeSer.writeTypePrefixForScalar(thisjgen);
         this.serialize(jgenprovider);
         typeSer.writeTypeSuffixForScalar(thisjgen);
     }
 
     @Override
     public void serialize(JsonGenerator jgenSerializerProvider provider)
             throws IOExceptionJsonProcessingException
     {
         jgen.writeString(toCanonical());
     } 
     
     /*
     /**********************************************************
     /* Methods for sub-classes to use
     /**********************************************************
      */

    

Parameters:
trailingSemicolon Whether to add trailing semicolon for non-primitive (reference) types or not
    protected static StringBuilder _classSignature(Class<?> clsStringBuilder sb,
           boolean trailingSemicolon)
    {
        if (cls.isPrimitive()) {
            if (cls == .) {                
                sb.append('Z');
            } else if (cls == .) {
                sb.append('B');
            }
            else if (cls == .) {
                sb.append('S');
            }
            else if (cls == .) {
                sb.append('C');
            }
            else if (cls == .) {
                sb.append('I');
            }
            else if (cls == .) {
                sb.append('J');
            }
            else if (cls == .) {
                sb.append('F');
            }
            else if (cls == .) {
                sb.append('D');
            }
            else if (cls == .) {
                sb.append('V');
            } else {
                throw new IllegalStateException("Unrecognized primitive type: "+cls.getName());
            }
        } else {
            sb.append('L');
            String name = cls.getName();
            for (int i = 0, len = name.length(); i < len; ++i) {
                char c = name.charAt(i);
                if (c == '.'c = '/';
                sb.append(c);
            }
            if (trailingSemicolon) {
                sb.append(';');
            }
        }
        return sb;
    }
New to GrepCode? Check out our FAQ X