2121 */
2222
2323import act .util .DestroyableBase ;
24+ import org .osgl .$ ;
2425import org .osgl .exception .ConfigurationException ;
2526import org .osgl .exception .UnexpectedNewInstanceException ;
26- import org .osgl .util .C ;
27+ import org .osgl .util .Keyword ;
2728import org .osgl .util .S ;
2829
2930import java .util .HashMap ;
@@ -157,7 +158,7 @@ public <T> List<T> getList(AppConfigKey key, Class<T> c) {
157158 /**
158159 * Look up configuration by a <code>String<code/> key. If the String key
159160 * can be converted into {@link AppConfigKey rythm configuration key}, then
160- * it is converted and call to {@link #get(ConfigKey)} method. Otherwise
161+ * it is converted and call to {@link #get(ConfigKey, Object )} method. Otherwise
161162 * the original configuration map is used to fetch the value from the string key
162163 *
163164 * @param key
@@ -177,37 +178,16 @@ public <T> T get(String key) {
177178 }
178179
179180 public <T > T getIgnoreCase (String key ) {
180- if (key .startsWith (PREFIX )) {
181- key = key .substring (PREFIX_LEN );
182- }
183- T t = get (key );
184- if (null != t ) {
185- return t ;
186- }
187- key = key .toUpperCase ();
188- for (Map .Entry <String , Object > entries : raw .entrySet ()) {
189- if (entries .getKey ().toUpperCase ().equals (key )) {
190- Object o = entries .getValue ();
191- if (o instanceof String ) {
192- return (T ) AppConfigKey .helper .evaluate (o .toString (), raw );
193- }
194- return (T ) o ;
195- } else if (entries .getKey ().replace ('_' , '.' ).equals (key .replace ('_' , '.' ))) {
196- Object o = entries .getValue ();
197- if (o instanceof String ) {
198- return (T ) AppConfigKey .helper .evaluate (o .toString (), raw );
199- }
200- return (T ) o ;
201- }
202- }
203- return null ;
181+ // because of #635 we just return get(key)
182+ return get (key );
204183 }
205184
206185 public Map <String , Object > rawConfiguration () {
207186 return raw ;
208187 }
209188
210189 public Map <String , Object > subSet (String namespace ) {
190+ namespace = Config .canonical (namespace );
211191 if (!namespace .endsWith ("." )) {
212192 namespace = namespace + "." ;
213193 }
@@ -234,10 +214,19 @@ public Map<String, Object> subSet(String namespace) {
234214
235215 protected abstract ConfigKey keyOf (String s );
236216
217+ public static String canonical (String key ) {
218+ return Keyword .of (key ).dotted ();
219+ }
220+
221+ public static boolean matches (String k1 , String k2 ) {
222+ return $ .eq (Keyword .of (k1 ), Keyword .of (k2 ));
223+ }
224+
237225 private static final Object NULL = new Object () {
238226 @ Override
239227 public String toString () {
240228 return "null" ;
241229 }
242230 };
231+
243232}
0 commit comments