com.planetalia.dynject.validation
Class ErrorMap

java.lang.Object
  extended by com.planetalia.dynject.util.MultiMap<java.lang.String,ErrorMessage>
      extended by com.planetalia.dynject.validation.ErrorMap

public class ErrorMap
extends MultiMap<java.lang.String,ErrorMessage>

Represents a map of errors, consisting of a list of ErrorMessage bound to a property name.

Author:
Alexander Hristov

Field Summary
static java.lang.String DEFAULT_KEY
          Key to which error messages that are not related to any specific property are bound.
 
Constructor Summary
ErrorMap()
           
 
Method Summary
 void merge(ErrorMap map)
          Merges the errors from the specified error map into the current one.
 void putLiteralMessage(java.lang.String propertyName, java.lang.String message)
          Creates and binds a new literal error message
 void putMessage(java.lang.String propertyName, java.lang.String messageKey)
          Creates and binds a new error message
 void putMessage(java.lang.String propertyName, java.lang.String messageKey, java.lang.Object... param)
          Creates and binds a new error message
 java.lang.String toString()
           
 
Methods inherited from class com.planetalia.dynject.util.MultiMap
clear, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, putAll, putAll, putAll, remove, size, values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_KEY

public static final java.lang.String DEFAULT_KEY
Key to which error messages that are not related to any specific property are bound.

See Also:
Constant Field Values
Constructor Detail

ErrorMap

public ErrorMap()
Method Detail

putMessage

public void putMessage(java.lang.String propertyName,
                       java.lang.String messageKey)
Creates and binds a new error message

Parameters:
propertyName - Property to which this error message belongs
messageKey - Message key (possibly for accessing an external resource bundle)

putMessage

public void putMessage(java.lang.String propertyName,
                       java.lang.String messageKey,
                       java.lang.Object... param)
Creates and binds a new error message

Parameters:
propertyName - Property to which this error message belongs
messageKey - Message key (possibly for accessing an external resource bundle)
param - message parameters

putLiteralMessage

public void putLiteralMessage(java.lang.String propertyName,
                              java.lang.String message)
Creates and binds a new literal error message

Parameters:
propertyName - Property to which this error message belongs
message - Literal (textual) message to use as a description.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

merge

public void merge(ErrorMap map)
Merges the errors from the specified error map into the current one.

Parameters:
map - Map of errors to merge.