[json-lib-user] setBeanProcessors
Brought to you by:
aalmiray
From: Sundling, P. <Pau...@sm...> - 2009-04-11 02:31:43
|
It seems like it would be nice to have a convenience method to set multiple bean processors on JsonConfig. There are ways to do so in Spring using FactoryBean and Initializing bean, even though there is not a normal setter like my convenience method below. If it's not deemed generally useful, it could be added to the JsonView for json-lib-ext-spring instead. Here's the jdk15 version of what I'm thinking: public void setJsonBeanProcessors(Map<Class, JsonBeanProcessor> jsonBeanProcessors) { Set<Class> classes = jsonBeanProcessors.keySet(); for (Iterator<Class> iterator = classes.iterator(); iterator.hasNext();) { Class target = iterator.next(); registerJsonBeanProcessor(target, jsonBeanProcessors.get(target)); } } Then a convenience method coupld be added to delegate this in JsonView to it's JsonConfig. What do you think? Paul Sundling |