|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Retention(value=RUNTIME) @Documented @Target(value=TYPE) public @interface ParentMessageParam
Adds information to a field of the parent exception about which parameter in a message it provides information. This way the attributes (properties) 'message' and (more important) cause can be accessed to provide information for a place holder in a message template.
MessageParam
Optional Element Summary | |
---|---|
String |
value The index of the place holder in the message text the field provides information for. |
public abstract String value
If the index is not sufficient, because there is a certain property within the referenced entity, an OGNL (Object-Graph Navigation Language may be added to access a particular value.
Syntax
property=index:ognl-path
Example
cause=1:message
If several properties of a referenced entity are to be displayed at different indices, separate them by commas and the information for different properties separate by colons (;
).
Example
cause=1:message,3:message,4:localizedMessage; message=5
Example 1
Example:
@ParentMessageParam("cause=0:message") public class MethodAccessConfigurationException extends PropertyAccessConfigurationException
The parent property cause
provides the information for placeholder 1
by the throwable's message
text.
Example 2
Example:
@ParentMessageParam( "cause=1:message,3:message,4:localizedMessage; message=5") public class ExampleException extends AbstractLocalizedRuntimeException
The parent property
provides the information ( cause
) for placeholder message
1
and 3
(just to show how the same information can be used for different placeholders), the
provides information for placeholder localizedMessage
4
and the parent's
is used to supply a value for placeholder message
5
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |