Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 1e40708d27c4c28105bc08ffd518662626d2c6a0 1 parent e8f7c74
Raymond Feng raymondfeng authored
10 modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/jackson/JacksonHelper.java
View
@@ -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;
- }
+ }
+
}
Please sign in to comment.
Something went wrong with that request. Please try again.