de.smartics.exceptions.i18n.message
Class MessageParamParser

Package class diagram package MessageParamParser
java.lang.Object
  extended by de.smartics.exceptions.i18n.message.MessageParamParser

public final class MessageParamParser
     
     
extends Object

This class provides methods to parse message parameter.


Nested Class Summary
static class MessageParamParser.MessageParamInfo
          Contains the index information for one message parameter.
 
Method Summary
static List<MessageParamParser.MessageParamInfo> parse(String input)
          Splits the input string into message param informations.
static Map<String,List<MessageParamParser.MessageParamInfo>> parseParentMessageParam(String input)
          Parses the content of the parent message parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

parse

public static List<MessageParamParser.MessageParamInfo> parse(String input)
                                                       throws ParseException
Splits the input string into message param informations.

The expected format is a comma separated list of index:ognlPath strings. The OGNL path may be missing, in this case the index alone.

Example: 0:user.name,4,3:user.id.

Spaces between tokens are removed.

If the input string is null or empty, the empty list is returned.

Parameters:
input - the input string to parse.
Returns:
the list of message parameter infos.
Throws:
ParseException - if the input is violating the expected syntax.

parseParentMessageParam

public static Map<String,List<MessageParamParser.MessageParamInfo>> parseParentMessageParam(String input)
                                                                                     throws ParseException
Parses the content of the parent message parameter. The input must follow the following syntax:

property=index:ognl-path as in 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 attributes separate by colons (;).

cause=1:cause.message,3:message,4:localizedMessage; message=5

Parameters:
input - the input string to parse.
Returns:
the parsed information. The key of the map is the name of the attribute, the value is the index information for that attribute.
Throws:
ParseException - if the input is violating the expected syntax.


Copyright © 2007-2013 Kronseder & Reiner GmbH - smartics. All Rights Reserved.