Is there a way I can use Jackson JSON Views or something like that without having to comment on the original bean class? I am looking for some kind of runtime / dynamic configuration to allow me to do something like this.
My bean is an @Entity packaged in a JAR that can be used by several projects. I try to avoid touching and repackaging the common JAR due to user interface changes in consuming projects.
Ideally, I would like to do something like
jsonViewBuilder = createViewBuilder(View.class); jsonViewBuilder.addProperty("property1"); jsonViewBuilder.addProperty("property2");
to replace
Bean { @JsonView(View.class) String property1; @JsonView(View.class) String property2; }
Any ideas?
Base environment: Spring 3.0, Spring MVC, and Glassfish 3.1.1.
json spring jackson spring-mvc
wrschneider
source share