public InternalTypeSerializer(Class<T> baseClass, TypeIdResolver typeIdResolver) { super(baseClass); this.typeSerializer = new AsPropertyTypeSerializer(typeIdResolver, null, TYPE_PROPERTY); }
/** * Helper method for constructing standard {@link TypeResolverBuilder} * implementation. */ protected StdTypeResolverBuilder _constructStdTypeResolverBuilder() { return new StdTypeResolverBuilder(); }
@Override public TypeDeserializer forProperty(BeanProperty prop) { if (prop == _property) { // usually if it's null return this; } return new AsExternalTypeDeserializer(this, prop); }
@Override public Object deserializeTypedFromAny(JsonParser p, DeserializationContext ctxt) throws IOException { /* Sometimes, however, we get an array wrapper; specifically * when an array or list has been serialized with type information. */ if (p.getCurrentToken() == JsonToken.START_ARRAY) { return super.deserializeTypedFromArray(p, ctxt); } return deserializeTypedFromObject(p, ctxt); }
@Override public TypeDeserializer buildTypeDeserializer(DeserializationConfig config, JavaType baseType, Collection<NamedType> subtypes) { return super.buildTypeDeserializer(config, baseType, subtypes); } }
@Override public TypeSerializer buildTypeSerializer(SerializationConfig config, JavaType baseType, Collection<NamedType> subtypes) { isAutowiredFiledInitialized = (this.capitalizer != null); return super.buildTypeSerializer(config, baseType, subtypes); }
@Override public String idFromValueAndType(Object value, Class<?> type) { /* 18-Jan-2013, tatu: We may be called with null value occasionally * it seems; nothing much we can figure out that way. */ if (value == null) { return idFromClass(type); } return idFromValue(value); }
/** * Deserializing type id enclosed using WRAPPER_OBJECT style is straightforward */ @Override public Object deserializeTypedFromObject(JsonParser jp, DeserializationContext ctxt) throws IOException { return _deserialize(jp, ctxt); }
/** * Method called when actual object is serialized as JSON Object */ @Override public Object deserializeTypedFromObject(JsonParser jp, DeserializationContext ctxt) throws IOException { return _deserialize(jp, ctxt); }
@Override public TypeDeserializer forProperty(BeanProperty prop) { // usually if it's null: return (prop == _property) ? this : new AsArrayTypeDeserializer(this, prop); }
/** * Helper method for dealing with "no type info" marker; can't be null * (as it'd be replaced by default typing) */ protected StdTypeResolverBuilder _constructNoTypeResolverBuilder() { return StdTypeResolverBuilder.noTypeInfoBuilder(); }
@Override public AsWrapperTypeSerializer forProperty(BeanProperty prop) { return (_property == prop) ? this : new AsWrapperTypeSerializer(_idResolver, prop); }
@Override public TypeDeserializer forProperty(BeanProperty prop) { return (prop == _property) ? this : new AsWrapperTypeDeserializer(this, prop); }
@Override public String idFromValueAndType(Object value, Class<?> type) { return _idFrom(value, type, _typeFactory); }
/** * @since 2.8.11 */ protected void _validateSubType(DeserializationContext ctxt, JavaType type, BeanDescription beanDesc) throws JsonMappingException { SubTypeValidator.instance().validateSubType(ctxt, type, beanDesc); } }
@Override public AsExistingPropertyTypeSerializer forProperty(BeanProperty prop) { return (_property == prop) ? this : new AsExistingPropertyTypeSerializer(_idResolver, prop, _typePropertyName); }
@Override public JavaType typeFromId(DatabindContext context, String id) { return _typeFromId(id); }
@Override public AsPropertyTypeSerializer forProperty(BeanProperty prop) { return (_property == prop) ? this : new AsPropertyTypeSerializer(this._idResolver, prop, this._typePropertyName); }
@Override public Object deserializeTypedFromAny(JsonParser jp, DeserializationContext ctxt) throws IOException { return _deserialize(jp, ctxt); }
/** * Method called when actual object is serialized as JSON Array. */ @Override public Object deserializeTypedFromArray(JsonParser jp, DeserializationContext ctxt) throws IOException { return _deserialize(jp, ctxt); }