Permalink
Browse files

Added support of the Jackson Smile format. Suggested by Tim Peierls.

  • Loading branch information...
1 parent 89d45f9 commit fbdc47893726e01751e200b6a8ec48c65e68f889 Thierry Boileau committed Apr 4, 2012
Showing with 17 additions and 16 deletions.
  1. +17 −16 modules/org.restlet.ext.jackson/src/org/restlet/ext/jackson/JacksonConverter.java
@@ -195,6 +195,7 @@ public float score(Object source, Variant target, Resource resource) {
Resource resource) throws IOException {
Object result = null;
+
JacksonSmileRepresentation<?> bSource = null;
if (source instanceof JacksonSmileRepresentation) {
bSource = (JacksonSmileRepresentation<?>) source;
@@ -209,23 +210,23 @@ public float score(Object source, Variant target, Resource resource) {
} else {
result = bSource.getObject();
}
- }
-
- // The source for the Jackson conversion
- JacksonRepresentation<?> jacksonSource = null;
- if (source instanceof JacksonRepresentation) {
- jacksonSource = (JacksonRepresentation<?>) source;
- } else if (VARIANT_JSON.isCompatible(source)) {
- jacksonSource = create(source, target);
- }
+ } else {
+ // The source for the Jackson conversion
+ JacksonRepresentation<?> jacksonSource = null;
+ if (source instanceof JacksonRepresentation) {
+ jacksonSource = (JacksonRepresentation<?>) source;
+ } else if (VARIANT_JSON.isCompatible(source)) {
+ jacksonSource = create(source, target);
+ }
- if (jacksonSource != null) {
- // Handle the conversion
- if ((target != null)
- && JacksonRepresentation.class.isAssignableFrom(target)) {
- result = jacksonSource;
- } else {
- result = jacksonSource.getObject();
+ if (jacksonSource != null) {
+ // Handle the conversion
+ if ((target != null)
+ && JacksonRepresentation.class.isAssignableFrom(target)) {
+ result = jacksonSource;
+ } else {
+ result = jacksonSource.getObject();
+ }
}
}

0 comments on commit fbdc478

Please sign in to comment.