List of usage examples for org.springframework.beans PropertyEditorRegistrar registerCustomEditors
void registerCustomEditors(PropertyEditorRegistry registry);
From source file:net.solarnetwork.web.support.JSONView.java
private BeanWrapper getPropertyAccessor(Object obj, PropertyEditorRegistrar registrar) { BeanWrapper bean = PropertyAccessorFactory.forBeanPropertyAccess(obj); if (registrar != null) { registrar.registerCustomEditors(bean); }//from w w w . jav a 2s. c om return bean; }
From source file:org.codehaus.groovy.grails.web.binding.GrailsDataBinder.java
/** * Collects all PropertyEditorRegistrars in the application context and * calls them to register their custom editors * * @param servletContext/*www .j a va2s. c om*/ * @param registry The PropertyEditorRegistry instance */ private static void registerCustomEditors(ServletContext servletContext, PropertyEditorRegistry registry) { if (servletContext == null) { return; } WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext); if (context == null) { return; } @SuppressWarnings("unchecked") Map<String, PropertyEditorRegistrar> editors = (Map<String, PropertyEditorRegistrar>) servletContext .getAttribute(PROPERTY_EDITOR_REGISTRARS); if (editors == null) { editors = context.getBeansOfType(PropertyEditorRegistrar.class); if (!Environment.isDevelopmentMode()) { servletContext.setAttribute(PROPERTY_EDITOR_REGISTRARS, editors); } } for (PropertyEditorRegistrar editorRegistrar : editors.values()) { editorRegistrar.registerCustomEditors(registry); } }