Subversion Repository Public Repository

litesoft

Diff Revisions 625 vs 626 for /trunk/GWT_Sandbox/FormEngine/src/com/temp/shared/externalization/E13nResolver.java

Diff revisions: vs.
  @@ -1,28 +1,54 @@
1 1 package com.temp.shared.externalization;
2 2
3 3 /**
4 - * Externalization Resolver that takes a E13nData (or String key) and resolves it to a String with an Externally Sourced String keyed template system that supports
5 - * substitutions within any specific template by "named" values.
4 + * Externalization Resolver that takes an E13nData (or Enum key or String key)
5 + * and resolves it to a String with an Externally Sourced String keyed template
6 + * system that supports substitutions within any specific template by "named"
7 + * values.
8 + *
9 + * Since Substitution Keys may NOT have spaces, spaces can be used to force a
10 + * what would appear to be a substitution key (something between the INIT & FINI
11 + * characters) to be ignored. Unbalanced INIT & FINI characters or an
12 + * empty substitution key are also ignored.
6 13 */
7 - public interface E13nResolver
8 - {
14 + public interface E13nResolver {
15 + public static final char PREFIX_SEP = '_';
16 + public static final char INIT = '{'; // For Substitution Key
17 + public static final char FINI = '}'; // For Substitution Key
18 + public static final String DONT_SHOW_SUBSTITUTION_ID = "{DontShow}"; // Replaced by a "" (empty String)
19 + public static final String SPACE_SUBSTITUTION_ID = "{Space}"; // used to force either leading or trailing spaces from being "trim()" away
20 +
9 21 /**
10 - * Resolves the 'data' to a String by implementing an Externally Sourced String keyed template system that supports
11 - * substitutions within any specific template by "named" values.
22 + * Resolves the 'data' to a String by implementing an Externally Sourced
23 + * String keyed template system that supports substitutions within any
24 + * specific template by "named" values.
12 25 *
13 26 * @param data !null
14 27 *
15 28 * @return Resolved String form of the !null 'data';
16 29 */
17 - public String resolve( E13nData data );
30 + public String resolve(E13nData data);
31 +
32 + /**
33 + * Resolves the 'key' (by optionally prefixing its name with the enum's
34 + * simple class name) to a String by implementing an Externally Sourced
35 + * String keyed template system that supports substitutions within any
36 + * specific template by "named" values.
37 + *
38 + * @param key !null
39 + *
40 + * @return Resolved String form of the !null 'key';
41 + */
42 + public String resolve(Enum<?> key);
18 43
19 44 /**
20 - * Resolves the 'key' to a String by implementing an Externally Sourced String keyed template system that supports
21 - * substitutions within any specific template by "named" values.
45 + * Resolves the 'key' to a String by implementing an Externally Sourced
46 + * String keyed template system that supports substitutions within any
47 + * specific template by "named" values.
22 48 *
23 49 * @param key !null & !empty (after trimming)
24 50 *
25 51 * @return Resolved String form of the !empty 'key';
26 52 */
27 - public String resolve( String key );
53 + public String resolve(String key);
28 54 }