1 21 package net.mlw.vlh; 22 23 import java.util.Map ; 24 25 31 public class Configuration 32 { 33 34 36 37 private Map adapters = null; 38 39 40 private ValueListAdapter defaultAdapter = null; 41 42 48 public ValueListAdapter getAdapter(String name) 49 { 50 ValueListAdapter adapter = (ValueListAdapter) adapters.get(name); 51 52 if (adapter == null) 53 { 54 adapter = getDefaultAdapter(); 55 } 56 57 if (adapter == null) 58 { 59 throw new NullPointerException ("Adapter named: " + name + ", not found, and no default was declared."); 60 } 61 return adapter; 62 } 63 64 68 public void setAdapters(Map adapters) 69 { 70 this.adapters = adapters; 71 } 72 73 76 public ValueListAdapter getDefaultAdapter() 77 { 78 return defaultAdapter; 79 } 80 81 85 public void setDefaultAdapter(ValueListAdapter defaultAdapter) 86 { 87 this.defaultAdapter = defaultAdapter; 88 } 89 } | Popular Tags |