|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springmodules.validation.bean.converter.ModelAwareErrorCodeConverter
public class ModelAwareErrorCodeConverter
Converts simple error codes to an error code that expresses the class and perhaps the property that are associated with the error code.
Constructor Summary | |
---|---|
ModelAwareErrorCodeConverter()
Constructs a new ModelAwareErrorCodeConverter that uses class simple names. |
|
ModelAwareErrorCodeConverter(boolean useFullyQualifiedClassName)
Constructs a new ModelAwareErrorCodeConverter. |
Method Summary | |
---|---|
String |
convertGlobalErrorCode(String errorCode,
Class clazz)
Converts the given error code to the following format: short_class_name[errorCode]
where short_class_name is the name of the given class with its package stripped, and
error_code is the given error code. |
String |
convertPropertyErrorCode(String errorCode,
Class clazz,
String propertyName)
Converts the given error code to the following format: short_class_name.property_name[errorCode]
where short_class_name is the name of the given class with its package stripped,
property_name is the given property name, and error_code is the given
error code. |
void |
setUseFullyQualifiedClassName(boolean useFullyQualifiedClassName)
Determines whether the converted error codes will use the fully qualified class names of the validated class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ModelAwareErrorCodeConverter()
error_code
for class org.springmodules.validation.sample.Person
will be converted
to Person[error_code]
.
public ModelAwareErrorCodeConverter(boolean useFullyQualifiedClassName)
error_code
for
class org.springmodules.validation.sample.Person
will be converted with fully qualified name set
to true
, the converted error code will be
org.springmodules.validation.sample.Person[error_code]
.
Method Detail |
---|
public String convertGlobalErrorCode(String errorCode, Class clazz)
short_class_name[errorCode]
where short_class_name
is the name of the given class with its package stripped, and
error_code
is the given error code.
convertGlobalErrorCode
in interface ErrorCodeConverter
errorCode
- The given error code (the one to convert)clazz
- The given class
public String convertPropertyErrorCode(String errorCode, Class clazz, String propertyName)
short_class_name.property_name[errorCode]
where short_class_name
is the name of the given class with its package stripped,
property_name
is the given property name, and error_code
is the given
error code.
convertPropertyErrorCode
in interface ErrorCodeConverter
errorCode
- The given error code (the one to convert)clazz
- The given classpropertyName
- The property name
public void setUseFullyQualifiedClassName(boolean useFullyQualifiedClassName)
useFullyQualifiedClassName
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |