Permalink
Browse files

Fix the default mapper so that it can handle tuscanyFilter

git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1383130 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent e8f7c74 commit 1e40708d27c4c28105bc08ffd518662626d2c6a0 @raymondfeng raymondfeng committed Sep 10, 2012
@@ -62,9 +62,10 @@
*
*/
public class JacksonHelper {
+ private final static SimpleBeanPropertyFilter DEFAULT_FILTER = SimpleBeanPropertyFilter.serializeAllExcept();
public final static ObjectMapper MAPPER = createMapper();
private final static JsonFactory FACTORY = new MappingJsonFactory(createMapper());
-
+
public static ObjectMapper createMapper() {
return createObjectMapper(null);
}
@@ -132,6 +133,7 @@ public Object findFilterId(AnnotatedClass annotatedClass) {
.withSerializationInclusion(JsonSerialize.Inclusion.NON_NULL)
.withDateFormat(StdDateFormat.getBlueprintISO8601Format()));
+ mapper.setFilters(new SimpleFilterProvider().addFilter("tuscanyFilter", DEFAULT_FILTER));
return mapper;
}
@@ -244,8 +246,7 @@ public static String write(JSONObject json) throws IOException {
throw new IOException(e);
}
}
-
- private final static SimpleBeanPropertyFilter DEFAULT_FILTER = SimpleBeanPropertyFilter.serializeAllExcept();
+
public static FilterProvider configureFilterProvider(TransformationContext context) {
SimpleBeanPropertyFilter filter = DEFAULT_FILTER;
@@ -260,5 +261,6 @@ public static FilterProvider configureFilterProvider(TransformationContext conte
}
FilterProvider filters = new SimpleFilterProvider().addFilter("tuscanyFilter", filter);
return filters;
- }
+ }
+
}

0 comments on commit 1e40708

Please sign in to comment.