/** * Does the current state of the TML represent an error? This is determined by * checking for any individual message which is at the * {@link TargettedMessage#SEVERITY_ERROR} severity level. * @return true if there is an error otherwise false */ public boolean isError() { for (int i = 0; i < size(); ++i) { if (messageAt(i).isError()) return true; } return false; }
public TargettedMessage(String[] messagecodes, Object[] args, String targetid) { updateTarget(targetid); this.messagecodes = messagecodes; this.args = args; }
public TargettedMessage(String messagecode, Object[] args, String targetid) { updateMessageCode(messagecode); updateTarget(targetid); this.args = args; }
/** * Appends multiple messages to this list, through multiple calls to * {@link #addMessage(TargettedMessage)}. * @param list List of messages to add */ public void addMessages(TargettedMessageList list) { for (int i = 0; i < list.size(); ++i) { addMessage(list.messageAt(i)); } }
/** Determines whether this message list contains a general action error entry, and * returns it. * @return error or null if no error */ public TargettedMessage findGeneralError() { for (int i = 0; i < size(); ++ i) { TargettedMessage message = messageAt(i); if (CoreMessages.GENERAL_ACTION_ERROR.equals(message.acquireMessageCode())) return message; if (CoreMessages.GENERAL_SHOW_ERROR.equals(message.acquireMessageCode())) return message; } return null; }
public void setValue(Object obj) { if (obj == null || obj.equals("")) { throw new TargettedMessageException(new TargettedMessage(code)); } }
public TargettedMessage(String messagecode, Object[] args, Exception exception) { updateMessageCode(messagecode); this.args = args; this.exception = exception; }
/** * @param code the code to lookup up, such as 'calculator.noRateSet' * @param args Array of arguments that will be filled in for params within the * message (params look like "{0}", "{1,date}", "{2,time}" within a * message), or <code>null</code> if none. * @return the resolved message, or a default message if not found. */ public String getMessage(String code, Object[] args) { return getMessage(new String[] { code }, args); }
public TargettedMessage(String messagecode, Exception exception, String targetid) { updateMessageCode(messagecode); updateTarget(targetid); this.exception = exception; }
public TargettedMessage(String messagecode, Object[] args) { updateMessageCode(messagecode); this.args = args; }
/** Resolve a defaultible message which takes no arguments * @see #getMessage(String[], Object[]) * @param code An array of potential message codes to be looked up, in order * of priority. Each code will be looked up in turn and the resolved message * from the first which is found will be returned, if any. This strategy * matches that of Spring's MessageSourceResolvable. * @return message */ public String getMessage(String[] code) { return getMessage(code, null); }
public TargettedMessage(String messagecode, Object[] args, Exception exception, String targetid) { updateMessageCode(messagecode); updateTarget(targetid); this.args = args; this.exception = exception; }
public TargettedMessage(String messagecode, Exception exception) { updateMessageCode(messagecode); this.exception = exception; }
/** @see BeanLocator#locateBean(String) */ public Object locateBean(String path) { return getMessage(new String[] { path }, null); }
/** Construct a simple targetted message * @param messagecode The message key for resolving the message text. * @param targetid The target field or path of the message, if <code>null</code> * will be substituted with {@link #TARGET_NONE}. */ public TargettedMessage(String messagecode, String targetid) { updateMessageCode(messagecode); this.targetid = targetid == null ? TARGET_NONE : targetid; }
/** @see BeanResolver#resolveBean(Object) */ public String resolveBean(Object bean) { return getMessage((String) bean, null); }
public TargettedMessage(String messagecode, Object[] args, int severity) { updateMessageCode(messagecode); this.args = args; this.severity = severity; }
public String getMessage(String[] code, Object param) { return getMessage(code, new Object[] { param }); }
public TargettedMessage(String messagecode) { updateMessageCode(messagecode); }
public String getMessage(String code, Object param) { return getMessage(new String[] { code }, new Object[] { param }); }