org.springmodules.validation.bean.converter
Class ModelAwareMessageCodesResolver

java.lang.Object
  extended by org.springmodules.validation.bean.converter.ModelAwareMessageCodesResolver
All Implemented Interfaces:
Serializable, MessageCodesResolver

public class ModelAwareMessageCodesResolver
extends Object
implements MessageCodesResolver, Serializable

A MessageCodesResolver implementation that can be used along with the ModelAwareErrorCodeConverter. This resolver extracts the basic error code from the model-aware one and uses an internal message code converter to resolve all error codes for the this basic error code. The model-aware one is then added to the top of the error codes list. For example, if the internal messagee code resolver is DefaultMessageCodesResolver, the model-aware error code is Person.firstName[not.blank], and the basic error code is not.blank, then the resolved error codes will be:

Author:
Uri Boness
See Also:
Serialized Form

Constructor Summary
ModelAwareMessageCodesResolver()
          Constructs a new ModelAwareErrorCodeConverter with DefaultMessageCodesResolver as the internal resolver.
ModelAwareMessageCodesResolver(MessageCodesResolver internalResolver)
          Constructs a new ModelAwareErrorCodeConverter with a given internal message codes resolver.
 
Method Summary
 String[] resolveMessageCodes(String errorCode, String objectName)
           
 String[] resolveMessageCodes(String errorCode, String objectName, String field, Class fieldType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModelAwareMessageCodesResolver

public ModelAwareMessageCodesResolver()
Constructs a new ModelAwareErrorCodeConverter with DefaultMessageCodesResolver as the internal resolver.


ModelAwareMessageCodesResolver

public ModelAwareMessageCodesResolver(MessageCodesResolver internalResolver)
Constructs a new ModelAwareErrorCodeConverter with a given internal message codes resolver.

Parameters:
internalResolver - The internal message codes resolver to be used.
Method Detail

resolveMessageCodes

public String[] resolveMessageCodes(String errorCode,
                                    String objectName)
Specified by:
resolveMessageCodes in interface MessageCodesResolver
See Also:
MessageCodesResolver.resolveMessageCodes(String, String)

resolveMessageCodes

public String[] resolveMessageCodes(String errorCode,
                                    String objectName,
                                    String field,
                                    Class fieldType)
Specified by:
resolveMessageCodes in interface MessageCodesResolver
See Also:
MessageCodesResolver.resolveMessageCodes(String, String, String, Class)


Copyright © 2009. All Rights Reserved.