datasource/Cached_Content_Loader: added caching content loader
[metux-java.git] / propertylist / FallbackPropertylist.java
blobc30b44ec10bd02fe63bd8913625bc0d6bdad899f
1 /*
3 special type of propertylist, which has calls an fallback
4 if some key cannot be found.
6 this is ie useful to build up derivation hierachies
8 */
10 package org.de.metux.propertylist;
12 import java.util.Properties;
14 public class FallbackPropertylist extends Propertylist
16 IPropertylist fallback;
18 public FallbackPropertylist(Properties p)
20 super();
21 loadHash_top(p);
24 public FallbackPropertylist(IPropertylist f)
26 fallback = f;
29 public String get_raw(String key)
30 throws EIllegalValue
32 String value = super.get_raw(key);
33 // System.err.println("FallbackPropertylist::get_raw(\""+key+"\") => \""+value+"\"");
35 if (value!=null)
36 return value;
38 // we have no fallbacks ... jump out
39 if (fallback==null)
40 return null;
42 // for (int x=0; x<fallback.length; x++)
43 // {
44 // if (fallback[x]!=null)
45 // {
46 /// value = fallback[x].get_raw(key);
47 // if (value!=null)
48 // return value;
49 // }
50 // }
51 return fallback.get_raw(key);
53 // return null;
56 public void setFallback(IPropertylist f)
58 // fallback = new IPropertylist[1];
59 // fallback[0] = f;
60 fallback = f;
63 public String toString()
65 return "[PRIMARY]\n"+super.toString()+
66 ((fallback==null) ? "" : "[FALLBACK]\n"+fallback.toString());
69 public IPropertylist clone()
71 // System.err.println("FallbackPropertylist::clone()");
72 // return new FallbackPropertylist(fallback[0]);
73 return new FallbackPropertylist(fallback);