1
2
3
4
5
6
7 package org.weda.message.impl;
8
9 import org.weda.message.Messages;
10
11 /**
12 *
13 * @author Mikhail Titov
14 */
15 public abstract class AbstractMessages implements Messages {
16
17 public String extractMessageKey(String str) {
18 if (str==null)
19 return null;
20 String key=null;
21 int pos = str.indexOf(':');
22 if ( pos>0
23 && str.length()>(pos+1)
24 && getInPlacePrefix().equals(str.substring(0, pos)))
25 {
26 key = str.substring(pos+1);
27 }
28 return key;
29 }
30
31 public String replaceInPlace(String str) {
32 String key = extractMessageKey(str);
33 if (key==null)
34 return str;
35 else
36 return getMessage(key);
37 }
38
39
40 }