upgrade to jackson 1.5

This commit is contained in:
kimchy 2010-03-14 21:24:47 +02:00
parent 1de6509107
commit 20877a0c79
3 changed files with 16 additions and 8 deletions

View File

@ -1,15 +1,15 @@
<component name="libraryTable"> <component name="libraryTable">
<library name="jackson"> <library name="jackson">
<CLASSES> <CLASSES>
<root url="jar://$GRADLE_REPOSITORY$/org.codehaus.jackson/jackson-core-asl/jars/jackson-core-asl-1.4.2.jar!/" /> <root url="jar://$GRADLE_REPOSITORY$/org.codehaus.jackson/jackson-core-asl/jars/jackson-core-asl-1.5.0.jar!/" />
<root url="jar://$GRADLE_REPOSITORY$/org.codehaus.jackson/jackson-mapper-asl/jars/jackson-mapper-asl-1.4.2.jar!/" /> <root url="jar://$GRADLE_REPOSITORY$/org.codehaus.jackson/jackson-mapper-asl/jars/jackson-mapper-asl-1.5.0.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>
<root url="file://$PROJECT_DIR$/../../../opt/jackson/1.4.2/src/java" /> <root url="file://$PROJECT_DIR$/../../../opt/jackson/1.5.0/src/jaxrs/java" />
<root url="file://$PROJECT_DIR$/../../../opt/jackson/1.4.2/src/mapper/java" /> <root url="file://$PROJECT_DIR$/../../../opt/jackson/1.5.0/src/xc/java" />
<root url="file://$PROJECT_DIR$/../../../opt/jackson/1.4.2/src/xc/java" /> <root url="file://$PROJECT_DIR$/../../../opt/jackson/1.5.0/src/mapper/java" />
<root url="file://$PROJECT_DIR$/../../../opt/jackson/1.4.2/src/jaxrs/java" /> <root url="file://$PROJECT_DIR$/../../../opt/jackson/1.5.0/src/java" />
</SOURCES> </SOURCES>
</library> </library>
</component> </component>

View File

@ -36,8 +36,8 @@ dependencies {
compile 'joda-time:joda-time:1.6' compile 'joda-time:joda-time:1.6'
compile 'com.google.collections:google-collections:1.0' compile 'com.google.collections:google-collections:1.0'
compile 'org.codehaus.jackson:jackson-core-asl:1.4.2' compile 'org.codehaus.jackson:jackson-core-asl:1.5.0'
compile 'org.codehaus.jackson:jackson-mapper-asl:1.4.2' compile 'org.codehaus.jackson:jackson-mapper-asl:1.5.0'
compile 'aopalliance:aopalliance:1.0' compile 'aopalliance:aopalliance:1.0'
compile 'com.google.inject:guice:2.0' compile 'com.google.inject:guice:2.0'

View File

@ -109,6 +109,10 @@ public final class Jackson {
private final FormatDateTimeFormatter formatter = Joda.forPattern("dateTime"); private final FormatDateTimeFormatter formatter = Joda.forPattern("dateTime");
public DateSerializer() {
super(Date.class);
}
@Override public void serialize(Date value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonGenerationException { @Override public void serialize(Date value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonGenerationException {
jgen.writeString(formatter.parser().print(value.getTime())); jgen.writeString(formatter.parser().print(value.getTime()));
} }
@ -140,6 +144,10 @@ public final class Jackson {
private final FormatDateTimeFormatter formatter = Joda.forPattern("dateTime"); private final FormatDateTimeFormatter formatter = Joda.forPattern("dateTime");
public DateTimeSerializer() {
super(DateTime.class);
}
@Override public void serialize(DateTime value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonGenerationException { @Override public void serialize(DateTime value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonGenerationException {
jgen.writeString(formatter.printer().print(value)); jgen.writeString(formatter.printer().print(value));
} }