org.springframework.web.bind.support

Class DefaultDataBinderFactory

  • java.lang.Object
    • org.springframework.web.bind.support.DefaultDataBinderFactory
    • Constructor Detail

      • DefaultDataBinderFactory

        public DefaultDataBinderFactory(@Nullable
                                        WebBindingInitializer initializer)
        Create a new DefaultDataBinderFactory instance.
        Parameters:
        initializer - for global data binder initialization (or null if none)
    • Method Detail

      • createBinder

        public final WebDataBinder createBinder(NativeWebRequest webRequest,
                                                @Nullable
                                                java.lang.Object target,
                                                java.lang.String objectName)
                                         throws java.lang.Exception
        Create a new WebDataBinder for the given target object and initialize it through a WebBindingInitializer.
        Specified by:
        createBinder in interface WebDataBinderFactory
        Parameters:
        webRequest - the current request
        target - the object to create a data binder for, or null if creating a binder for a simple type
        objectName - the name of the target object
        Returns:
        the created WebDataBinder instance, never null
        Throws:
        java.lang.Exception - in case of invalid state or arguments
      • createBinderInstance

        protected WebDataBinder createBinderInstance(@Nullable
                                                     java.lang.Object target,
                                                     java.lang.String objectName,
                                                     NativeWebRequest webRequest)
                                              throws java.lang.Exception
        Extension point to create the WebDataBinder instance. By default this is WebRequestDataBinder.
        Parameters:
        target - the binding target or null for type conversion only
        objectName - the binding target object name
        webRequest - the current request
        Throws:
        java.lang.Exception - in case of invalid state or arguments
      • initBinder

        protected void initBinder(WebDataBinder dataBinder,
                                  NativeWebRequest webRequest)
                           throws java.lang.Exception
        Extension point to further initialize the created data binder instance (e.g. with @InitBinder methods) after "global" initialization via WebBindingInitializer.
        Parameters:
        dataBinder - the data binder instance to customize
        webRequest - the current request
        Throws:
        java.lang.Exception - if initialization fails