@Override public AsArrayTypeSerializer forProperty(BeanProperty prop) { return (_property == prop) ? this : new AsArrayTypeSerializer(_idResolver, prop); }
@Override public void writeTypePrefixForScalar(Object value, JsonGenerator jgen, Class<?> type) throws IOException, JsonProcessingException { // only need the wrapper array jgen.writeStartArray(); jgen.writeString(idFromValueAndType(value, type)); }
@Override public void writeTypePrefixForScalar(Object value, JsonGenerator jgen) throws IOException, JsonProcessingException { // only need the wrapper array jgen.writeStartArray(); jgen.writeString(idFromValue(value)); }
@Override public void writeCustomTypeSuffixForObject(Object value, JsonGenerator jgen, String typeId) throws IOException, JsonProcessingException { writeTypeSuffixForObject(value, jgen); // standard impl works fine }
public void writeCustomTypeSuffixForScalar(Object value, JsonGenerator jgen, String typeId) throws IOException, JsonProcessingException { writeTypeSuffixForScalar(value, jgen); // standard impl works fine } }
@Override public void writeCustomTypeSuffixForArray(Object value, JsonGenerator jgen, String typeId) throws IOException, JsonProcessingException { writeTypeSuffixForArray(value, jgen); // standard impl works fine }
@Override public void writeTypePrefixForScalar(Object value, JsonGenerator jgen, Class<?> type) throws IOException, JsonProcessingException { // only need the wrapper array jgen.writeStartArray(); jgen.writeString(idFromValueAndType(value, type)); }
@Override public void writeTypePrefixForScalar(Object value, JsonGenerator jgen) throws IOException, JsonProcessingException { // only need the wrapper array jgen.writeStartArray(); jgen.writeString(idFromValue(value)); }
public void writeCustomTypeSuffixForObject(Object value, JsonGenerator jgen, String typeId) throws IOException, JsonProcessingException { writeTypeSuffixForObject(value, jgen); // standard impl works fine }
@Override public void writeCustomTypeSuffixForScalar(Object value, JsonGenerator jgen, String typeId) throws IOException, JsonProcessingException { writeTypeSuffixForScalar(value, jgen); // standard impl works fine } }
public void writeCustomTypeSuffixForArray(Object value, JsonGenerator jgen, String typeId) throws IOException, JsonProcessingException { writeTypeSuffixForArray(value, jgen); // standard impl works fine }
@Override public TypeSerializer buildTypeSerializer(SerializationConfig config, JavaType baseType, Collection<NamedType> subtypes) { if (_idType == JsonTypeInfo.Id.NONE) { return null; } // 03-Oct-2016, tatu: As per [databind#1395] better prevent use for primitives, // regardless of setting if (baseType.isPrimitive()) { return null; } TypeIdResolver idRes = idResolver(config, baseType, subtypes, true, false); switch (_includeAs) { case WRAPPER_ARRAY: return new AsArrayTypeSerializer(idRes, null); case PROPERTY: return new AsPropertyTypeSerializer(idRes, null, _typeProperty); case WRAPPER_OBJECT: return new AsWrapperTypeSerializer(idRes, null); case EXTERNAL_PROPERTY: return new AsExternalTypeSerializer(idRes, null, _typeProperty); case EXISTING_PROPERTY: // as per [#528] return new AsExistingPropertyTypeSerializer(idRes, null, _typeProperty); } throw new IllegalStateException("Do not know how to construct standard type serializer for inclusion type: "+_includeAs); }
@Override public void writeTypePrefixForObject(Object value, JsonGenerator jgen, Class<?> type) throws IOException, JsonProcessingException { jgen.writeStartArray(); jgen.writeString(idFromValueAndType(value, type)); jgen.writeStartObject(); }
@Override public void writeTypePrefixForArray(Object value, JsonGenerator jgen) throws IOException, JsonProcessingException { jgen.writeStartArray(); jgen.writeString(idFromValue(value)); jgen.writeStartArray(); }
@Override public void writeCustomTypeSuffixForObject(Object value, JsonGenerator jgen, String typeId) throws IOException { if (!jgen.canWriteTypeId()) { writeTypeSuffixForObject(value, jgen); // standard impl works fine } }
@Override public void writeCustomTypeSuffixForScalar(Object value, JsonGenerator jgen, String typeId) throws IOException { if (!jgen.canWriteTypeId()) { writeTypeSuffixForScalar(value, jgen); // standard impl works fine } } }
@Override public void writeCustomTypeSuffixForArray(Object value, JsonGenerator jgen, String typeId) throws IOException { if (!jgen.canWriteTypeId()) { writeTypeSuffixForArray(value, jgen); // standard impl works fine } }
@Override public AsArrayTypeSerializer forProperty(BeanProperty prop) { if (_property == prop) return this; return new AsArrayTypeSerializer(this._idResolver, prop); }
@Override public void writeTypePrefixForObject(Object value, JsonGenerator jgen, Class<?> type) throws IOException, JsonProcessingException { jgen.writeStartArray(); jgen.writeString(idFromValueAndType(value, type)); jgen.writeStartObject(); }
@Override public void writeTypePrefixForArray(Object value, JsonGenerator jgen) throws IOException, JsonProcessingException { jgen.writeStartArray(); jgen.writeString(idFromValue(value)); jgen.writeStartArray(); }