| java.lang.Object org.kuali.core.util.ErrorMap
ErrorMap | public class ErrorMap implements Map,Serializable(Code) | | Holds errors due to validation. Keys of map represent property paths, and value is a TypedArrayList that contains resource string
keys (to retrieve the error message).
|
Method Summary | |
public void | addToErrorPath(String parentName) Adds a string prefix to the error path. | public void | clear() Clears the messages list. | public void | clearErrorPath() Clears the errorPath. | public boolean | containsKey(Object key) | public boolean | containsKeyMatchingPattern(String pattern) | public boolean | containsMessageKey(String messageKey) | public boolean | containsValue(Object value) | public int | countFieldMessages(String fieldName) | public Set | entrySet() | public boolean | equals(Object obj) | public boolean | fieldHasMessage(String fieldName, String errorKey) | public Object | get(Object key) | public int | getErrorCount() | public List | getErrorPath() This method returns the list that holds the error path values. | public String | getKeyPath(String propertyName, boolean prependFullErrorPath) This is what's prepended to the beginning of the key. | public TypedArrayList | getMessages(String path) | public List | getPropertiesWithErrors() | public int | hashCode() Returns the size, since that meets with the requirements of the hashCode contract, and since I don't expect ErrorMap to be
used as the key in a Map. | public boolean | isEmpty() | public Set | keySet() | public Object | put(Object key, Object value) | public void | putAll(Map arg0) | public TypedArrayList | putError(String propertyName, String errorKey, String... errorParameters) Adds an error to the map under the given propertyName and adds an array of message parameters. | public TypedArrayList | putErrorWithoutFullErrorPath(String propertyName, String errorKey, String... errorParameters) Adds an error to the map under the given propertyName and adds an array of message parameters. | public Object | remove(Object key) | public boolean | removeFromErrorPath(String parentName) Removes a string prefix from the error path. | public boolean | replaceError(String propertyName, String targetKey, String replaceKey, String... replaceParameters) If any error messages with the key targetKey exist in this ErrorMap for the named property, those ErrorMessages will be
replaced with a new ErrorMessage with the given replaceKey and replaceParameters. | public boolean | replaceErrorWithoutFullErrorPath(String propertyName, String targetKey, String replaceKey, String... replaceParameters) If any error messages with the key targetKey exist in this ErrorMap for the named property, those ErrorMessages will be
replaced with a new ErrorMessage with the given replaceKey and replaceParameters. | public int | size() | public String | toString() Renders as a String, to help debug tests. | public Collection | values() |
addToErrorPath | public void addToErrorPath(String parentName)(Code) | | Adds a string prefix to the error path.
Parameters: parentName - |
clear | public void clear()(Code) | | Clears the messages list.
|
clearErrorPath | public void clearErrorPath()(Code) | | Clears the errorPath.
|
containsKeyMatchingPattern | public boolean containsKeyMatchingPattern(String pattern)(Code) | | Parameters: pattern - comma separated list of keys, optionally ending with * wildcard |
containsMessageKey | public boolean containsMessageKey(String messageKey)(Code) | | true if the given messageKey is associated with some property in this ErrorMap |
containsValue | public boolean containsValue(Object value)(Code) | | Prevent people from directly accessing the values, since the input parameter isn't strongly-enough typed
Parameters: value - boolean |
countFieldMessages | public int countFieldMessages(String fieldName)(Code) | | Returns the number of messages for the given field
Parameters: fieldName - int |
fieldHasMessage | public boolean fieldHasMessage(String fieldName, String errorKey)(Code) | | Returns true if the named field has a message with the given errorKey
Parameters: errorKey - Parameters: fieldName - boolean |
getErrorCount | public int getErrorCount()(Code) | | Counts the total number of error messages in the map
returns an int for the total number of errors |
getErrorPath | public List getErrorPath()(Code) | | This method returns the list that holds the error path values.
List |
getKeyPath | public String getKeyPath(String propertyName, boolean prependFullErrorPath)(Code) | | This is what's prepended to the beginning of the key. This is built by iterating over all of the entries in the errorPath
list and concatenating them together witha "."
String Returns the keyPath. Parameters: propertyName - Parameters: prependFullErrorPath - |
getMessages | public TypedArrayList getMessages(String path)(Code) | | Parameters: path - Returns a List of ErrorMessages for the given path |
getPropertiesWithErrors | public List getPropertiesWithErrors()(Code) | | List of the property names that have errors. |
hashCode | public int hashCode()(Code) | | Returns the size, since that meets with the requirements of the hashCode contract, and since I don't expect ErrorMap to be
used as the key in a Map.
See Also: java.lang.Object.hashCode |
put | public Object put(Object key, Object value)(Code) | | Prevent people from adding arbitrary objects to the messages Map
Parameters: key - Parameters: value - Object |
putAll | public void putAll(Map arg0)(Code) | | Prevent people from adding arbitrary objects to the messages Map
Parameters: arg0 - |
putError | public TypedArrayList putError(String propertyName, String errorKey, String... errorParameters)(Code) | | Adds an error to the map under the given propertyName and adds an array of message parameters. This will fully prepend the
error key with any value in the errorPath list. This should be used when you do not want to add the error with the prepend
pre-built error path.
Parameters: propertyName - name of the property to add error under Parameters: errorKey - resource key used to retrieve the error text from the error message resource bundle Parameters: errorParameters - zero or more string parameters for the displayed error message TypedArrayList |
putErrorWithoutFullErrorPath | public TypedArrayList putErrorWithoutFullErrorPath(String propertyName, String errorKey, String... errorParameters)(Code) | | Adds an error to the map under the given propertyName and adds an array of message parameters. This will fully prepend the
error key with any value in the errorPath list.
Parameters: propertyName - name of the property to add error under Parameters: errorKey - resource key used to retrieve the error text from the error message resource bundle Parameters: errorParameters - zero or more string parameters for the displayed error message TypedArrayList |
removeFromErrorPath | public boolean removeFromErrorPath(String parentName)(Code) | | Removes a string prefix from the error path.
Parameters: parentName - boolean Returns true if the parentName existed, false otherwise. |
replaceError | public boolean replaceError(String propertyName, String targetKey, String replaceKey, String... replaceParameters)(Code) | | If any error messages with the key targetKey exist in this ErrorMap for the named property, those ErrorMessages will be
replaced with a new ErrorMessage with the given replaceKey and replaceParameters.
Parameters: propertyName - name of the property where existing error will be replaced Parameters: targetKey - error key of message to be replaced Parameters: replaceParameters - zero or more string parameters for the replacement error message true if the replacement occurred |
replaceErrorWithoutFullErrorPath | public boolean replaceErrorWithoutFullErrorPath(String propertyName, String targetKey, String replaceKey, String... replaceParameters)(Code) | | If any error messages with the key targetKey exist in this ErrorMap for the named property, those ErrorMessages will be
replaced with a new ErrorMessage with the given replaceKey and replaceParameters. The targetKey and replaceKey will be
prepended with the current errorPath, if any.
Parameters: propertyName - name of the property where existing error will be replaced Parameters: targetKey - error key of message to be replaced Parameters: replaceParameters - zero or more string parameters for the replacement error message true if the replacement occurred |
toString | public String toString()(Code) | | Renders as a String, to help debug tests.
a String, to help debug tests. |
values | public Collection values()(Code) | | Prevent people from directly accessing the values, since the input parameter isn't strongly-enough typed
Collection |
|
|