org.springframework.validation

Class BindingResultUtils

  • java.lang.Object
    • org.springframework.validation.BindingResultUtils


  • public abstract class BindingResultUtils
    extends java.lang.Object
    Convenience methods for looking up BindingResults in a model Map.
    Since:
    2.0
    Author:
    Juergen Hoeller
    See Also:
    BindingResult.MODEL_KEY_PREFIX
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static BindingResult getBindingResult(java.util.Map<?,?> model, java.lang.String name)
      Find the BindingResult for the given name in the given model.
      static BindingResult getRequiredBindingResult(java.util.Map<?,?> model, java.lang.String name)
      Find a required BindingResult for the given name in the given model.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BindingResultUtils

        public BindingResultUtils()
    • Method Detail

      • getBindingResult

        @Nullable
        public static BindingResult getBindingResult(java.util.Map<?,?> model,
                                                               java.lang.String name)
        Find the BindingResult for the given name in the given model.
        Parameters:
        model - the model to search
        name - the name of the target object to find a BindingResult for
        Returns:
        the BindingResult, or null if none found
        Throws:
        java.lang.IllegalStateException - if the attribute found is not of type BindingResult
      • getRequiredBindingResult

        public static BindingResult getRequiredBindingResult(java.util.Map<?,?> model,
                                                             java.lang.String name)
        Find a required BindingResult for the given name in the given model.
        Parameters:
        model - the model to search
        name - the name of the target object to find a BindingResult for
        Returns:
        the BindingResult (never null)
        Throws:
        java.lang.IllegalStateException - if no BindingResult found