public JavaType constructSpecializedType(JavaType baseType, Class<?> subclass) { return getTypeFactory().constructSpecializedType(baseType, subclass); }
@Override public JavaType findTypeMapping(DeserializationConfig config, JavaType type) { // this is the main mapping base, so let's Class<?> src = type.getRawClass(); Class<?> dst = _mappings.get(new ClassKey(src)); if (dst == null) { return null; } // 09-Aug-2015, tatu: Instead of direct call via JavaType, better use TypeFactory return config.getTypeFactory().constructSpecializedType(type, dst); }
@Override protected JavaType _typeFromId(final String id, final DatabindContext ctxt) { final TypeFactory typeFactory = ctxt.getTypeFactory(); Class<?> cls = DefaultClassDictionary.get().getClassById(Integer.parseInt(id), true); return typeFactory.constructSpecializedType(_baseType, cls); } }
@Override public TypeDeserializer buildTypeDeserializer(DeserializationConfig config, JavaType baseType, Collection<NamedType> subtypes) { if (_idType != JsonTypeInfo.Id.CUSTOM || _includeAs != JsonTypeInfo.As.WRAPPER_OBJECT) { return super.buildTypeDeserializer(config, baseType, subtypes); } final TypeIdResolver idRes = new ValueReferenceTypeIdResolver(baseType, config.getTypeFactory(), subtypes); final JavaType defaultImpl; if (_defaultImpl == null) { defaultImpl = null; } else { if ((_defaultImpl == Void.class) || (_defaultImpl == NoClass.class)) { defaultImpl = config.getTypeFactory().constructType(_defaultImpl); } else { defaultImpl = config.getTypeFactory().constructSpecializedType(baseType, _defaultImpl); } } return new AsValueReferenceTypeDeserializer(baseType, idRes, _typeProperty, _typeIdVisible, defaultImpl); }
type = ctxt.getTypeFactory().constructSpecializedType(_baseType, type.getRawClass());
&& !_primitiveAndWrapper(type, valueClass)) { try { type = tf.constructSpecializedType(type, valueClass); } catch (IllegalArgumentException iae) { throw new JsonMappingException(null, && !_primitiveAndWrapper(keyType, keyClass)) { try { keyType = tf.constructSpecializedType(keyType, keyClass); type = ((MapLikeType) type).withKeyType(keyType); } catch (IllegalArgumentException iae) { && !_primitiveAndWrapper(contentType, contentClass)) { try { contentType = tf.constructSpecializedType(contentType, contentClass); type = type.withContentType(contentType); } catch (IllegalArgumentException iae) {
return getTypeFactory().constructSpecializedType(baseType, cls);
} else { defaultImpl = config.getTypeFactory() .constructSpecializedType(baseType, _defaultImpl);
.constructSpecializedType(baseType, _defaultImpl); } else {
type = tf.constructGeneralizedType(type, serClass); } else if (currRaw.isAssignableFrom(serClass)) { // specialization, ok as well type = tf.constructSpecializedType(type, serClass); } else if (_primitiveAndWrapper(currRaw, serClass)) { keyType = tf.constructGeneralizedType(keyType, keyClass); } else if (currRaw.isAssignableFrom(keyClass)) { // specialization, ok as well keyType = tf.constructSpecializedType(keyType, keyClass); } else if (_primitiveAndWrapper(currRaw, keyClass)) { contentType = tf.constructGeneralizedType(contentType, contentClass); } else if (currRaw.isAssignableFrom(contentClass)) { // specialization, ok as well contentType = tf.constructSpecializedType(contentType, contentClass); } else if (_primitiveAndWrapper(currRaw, contentClass)) {
return tf.constructSpecializedType(baseType, deserClass); } catch (IllegalArgumentException iae) { throw new JsonMappingException(null, contentType = tf.constructSpecializedType(contentType, deserClass); return baseType.withContentType(contentType); } catch (IllegalArgumentException iae) {
rootType = typeFactory.constructSpecializedType(baseType, type);
@Override protected JavaType _typeFromId(final String id, final DatabindContext ctxt) throws IOException { Class<?> clazz = idToClass.get(id); if (clazz != null) { return _typeFactory.constructSpecializedType(_baseType, clazz); } return super._typeFromId(id, ctxt); }
@Override public JavaType typeFromId(String type) { Class<?> clazz = MessageTypeIdResolver.get(type); if (clazz == null) { throw new UnsupportedOperationException("No such defined type: " + type); } return TypeFactory.defaultInstance().constructSpecializedType(mBaseType, clazz); }
@Override protected JavaType _typeFromId(final String id, final DatabindContext ctxt) throws IOException { Class<?> clazz = idToClass.get(id); if (clazz != null) { return _typeFactory.constructSpecializedType(_baseType, clazz); } return super._typeFromId(id, ctxt); }
private static void addMapping(String classId, Class<?> basicClass, Class<?> genericClass) { JavaType javaType = genericClass == null ? TypeFactory.defaultInstance().constructSpecializedType(unknownType(), basicClass) : TypeFactory.defaultInstance().constructParametricType(basicClass, genericClass); BASIC_MAPPING.put(classId, javaType); log.trace("Added mapping for polymorphic deserialization {} <-> {}", classId, javaType); }
@Override protected JavaType _typeFromId(final String id, final TypeFactory typeFactory) { Class<?> cls = DefaultClassDictionary.get().getClassById(Integer.parseInt(id)); return typeFactory.constructSpecializedType(_baseType, cls); } }
@Override protected JavaType _typeFromId(final String id, final DatabindContext ctxt) { final TypeFactory typeFactory = ctxt.getTypeFactory(); Class<?> cls = DefaultClassDictionary.get().getClassById(Integer.parseInt(id), true); return typeFactory.constructSpecializedType(_baseType, cls); } }
@Override public JavaType findTypeMapping(DeserializationConfig config, JavaType type) { // this is the main mapping base, so let's Class<?> src = type.getRawClass(); Class<?> dst = _mappings.get(new ClassKey(src)); if (dst == null) { return null; } // 09-Aug-2015, tatu: Instead of direct call via JavaType, better use TypeFactory return config.getTypeFactory().constructSpecializedType(type, dst); }
@Override public JavaType findTypeMapping(DeserializationConfig config, JavaType type) { // this is the main mapping base, so let's Class<?> src = type.getRawClass(); Class<?> dst = _mappings.get(new ClassKey(src)); if (dst == null) { return null; } // 09-Aug-2015, tatu: Instead of direct call via JavaType, better use TypeFactory return config.getTypeFactory().constructSpecializedType(type, dst); }