dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20277
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9187: updated JacksonUtils to be explicit about which annotation-introspectors it should use
------------------------------------------------------------
revno: 9187
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-12-06 13:01:52 +0300
message:
updated JacksonUtils to be explicit about which annotation-introspectors it should use
modified:
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/utils/JacksonUtils.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/utils/JacksonUtils.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/utils/JacksonUtils.java 2012-12-06 09:06:40 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/utils/JacksonUtils.java 2012-12-06 10:01:52 +0000
@@ -33,6 +33,9 @@
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair;
+import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector;
+import com.fasterxml.jackson.dataformat.xml.JacksonXmlAnnotationIntrospector;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator;
import org.hisp.dhis.common.view.BasicView;
@@ -85,6 +88,14 @@
jsonMapper.getFactory().enable( JsonGenerator.Feature.QUOTE_FIELD_NAMES );
xmlMapper.configure( ToXmlGenerator.Feature.WRITE_XML_DECLARATION, true );
+ jsonMapper.setAnnotationIntrospector(
+ new JacksonAnnotationIntrospector() );
+
+ xmlMapper.setAnnotationIntrospector(
+ new AnnotationIntrospectorPair(
+ new JacksonXmlAnnotationIntrospector(),
+ new JacksonAnnotationIntrospector() ) );
+
// register view classes
viewClasses.put( "default", BasicView.class );
viewClasses.put( "basic", BasicView.class );