org.salespointframework.web.helper
Class MessagesUtil

java.lang.Object
  extended by org.salespointframework.web.helper.MessagesUtil

public class MessagesUtil
extends java.lang.Object

Toolbox class helping to handle a List of Strings under specific Keys(s.b.) inside a ModelAndView.

Author:
Lars Kreisz

Field Summary
static java.lang.String errorsKey
          key of error message list in model map
static java.lang.String flashKey
          key of success message list in model map
 
Constructor Summary
MessagesUtil()
           
 
Method Summary
static void addError(org.springframework.web.servlet.ModelAndView mav, java.lang.String error)
          adds an error message into the given model map
static void addFlash(org.springframework.web.servlet.ModelAndView mav, java.lang.String flash)
          adds an success message into the given model map
static java.util.List<java.lang.String> clearErrors(org.springframework.web.servlet.ModelAndView mav)
          clears the given model map from error messages
static java.util.List<java.lang.String> clearFlash(org.springframework.web.servlet.ModelAndView mav)
          clears the given model map from success messages
static boolean hasErrors(org.springframework.web.servlet.ModelAndView mav)
          checks if there are error messages in the given model map
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

errorsKey

public static final java.lang.String errorsKey
key of error message list in model map

See Also:
Constant Field Values

flashKey

public static final java.lang.String flashKey
key of success message list in model map

See Also:
Constant Field Values
Constructor Detail

MessagesUtil

public MessagesUtil()
Method Detail

addError

public static void addError(org.springframework.web.servlet.ModelAndView mav,
                            java.lang.String error)
adds an error message into the given model map

Parameters:
mav - the model map to insert error into
error - the error message to insert

addFlash

public static void addFlash(org.springframework.web.servlet.ModelAndView mav,
                            java.lang.String flash)
adds an success message into the given model map

Parameters:
mav - the model map to insert error into
flash - the success message to insert

clearErrors

public static java.util.List<java.lang.String> clearErrors(org.springframework.web.servlet.ModelAndView mav)
clears the given model map from error messages

Parameters:
mav - the model map to clear
Returns:
null or the list of messages that was removed

clearFlash

public static java.util.List<java.lang.String> clearFlash(org.springframework.web.servlet.ModelAndView mav)
clears the given model map from success messages

Parameters:
mav - the model map to clear
Returns:
null or the list of messages that was removed

hasErrors

public static boolean hasErrors(org.springframework.web.servlet.ModelAndView mav)
checks if there are error messages in the given model map

Parameters:
mav - the model map to check
Returns:
true, if there are error messages in the model map