private Mapper createMapper ( Type type ) { lock . lock ( ) ; try { Mapper mapper = cache . get ( type ) ; if ( mapper != null ) { return mapper ; } if ( type instanceof Class ) { mapper = createMapper ( ( Class < ? > ) type ) ; } else if ( type instanceof ParameterizedType ) { mapper = createMapper ( ( ParameterizedType ) type ) ; } else { throw new IllegalArgumentException ( String . format ( "Type %s is neither a Class nor ParameterizedType" , type ) ) ; } cache . put ( type , mapper ) ; return mapper ; } finally { lock . unlock ( ) ; } }
Creates a new mapper for the given type .