|
@@ -1,54 +1,54 @@ |
1 |
|
- |
package org.litesoft.core.util.externalization; |
2 |
|
- |
|
3 |
|
- |
/** |
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 |
|
- |
* <p/> |
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. |
13 |
|
- |
*/ |
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 |
|
- |
|
21 |
|
- |
/** |
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. |
25 |
|
- |
* |
26 |
|
- |
* @param data !null |
27 |
|
- |
* |
28 |
|
- |
* @return Resolved String form of the !null 'data'; |
29 |
|
- |
*/ |
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 ); |
43 |
|
- |
|
44 |
|
- |
/** |
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. |
48 |
|
- |
* |
49 |
|
- |
* @param key !null & !empty (after trimming) |
50 |
|
- |
* |
51 |
|
- |
* @return Resolved String form of the !empty 'key'; |
52 |
|
- |
*/ |
53 |
|
- |
public String resolve( String key ); |
54 |
|
- |
} |
|
1 |
+ |
package org.litesoft.core.util.externalization; |
|
2 |
+ |
|
|
3 |
+ |
/** |
|
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 |
+ |
* <p/> |
|
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. |
|
13 |
+ |
*/ |
|
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 |
+ |
|
|
21 |
+ |
/** |
|
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. |
|
25 |
+ |
* |
|
26 |
+ |
* @param data !null |
|
27 |
+ |
* |
|
28 |
+ |
* @return Resolved String form of the !null 'data'; |
|
29 |
+ |
*/ |
|
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 ); |
|
43 |
+ |
|
|
44 |
+ |
/** |
|
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. |
|
48 |
+ |
* |
|
49 |
+ |
* @param key !null & !empty (after trimming) |
|
50 |
+ |
* |
|
51 |
+ |
* @return Resolved String form of the !empty 'key'; |
|
52 |
+ |
*/ |
|
53 |
+ |
public String resolve( String key ); |
|
54 |
+ |
} |