helun/Ektorp

EktorpBeanSerializerModifier should implement serializeWithType

cmadsen opened this issue · 0 comments

EktorpBeanSerializerModifier should implement serializeWithType otherwise classes that uses typeinfo and are decorated with @DocumentReferences will not work as JsonSerializer<Object>::serializeWithType just throws "Type id handling not implemented for type".

class MyDocumentReferenceSerializer extends
            DocumentReferenceSerializer {

        JsonSerializer<Object> del;

        public MyDocumentReferenceSerializer(CouchDbConnector db,
                JsonSerializer<Object> delegate) {
            super(db, delegate);
            del = delegate;
        }

        @Override
        public void serializeWithType(Object value, JsonGenerator jgen,
                SerializerProvider provider, TypeSerializer typeSer)
                throws IOException, JsonProcessingException {
            // do same stuff as serialize in DocumentReferenceSerializer
            del.serializeWithType(value, jgen, provider, typeSer);
        }

    };