01: /*
02: * Created on Nov 16, 2005
03: */
04: package uk.org.ponder.beanutil.support;
05:
06: import java.util.HashMap;
07: import java.util.Map;
08:
09: import uk.org.ponder.beanutil.WriteableBeanLocator;
10:
11: /** A concrete manifestation of a WriteableBeanLocator, backed by a standard
12: * {@link Map}.
13: * @author Antranig Basman (antranig@caret.cam.ac.uk)
14: */
15:
16: public class ConcreteWBL implements WriteableBeanLocator {
17: private Map beans;
18:
19: public ConcreteWBL() {
20: beans = new HashMap();
21: }
22:
23: public ConcreteWBL(Map beans) {
24: this .beans = beans;
25: }
26:
27: public boolean remove(String beanname) {
28: return beans.remove(beanname) != null;
29: }
30:
31: public void set(String beanname, Object toset) {
32: beans.put(beanname, toset);
33: }
34:
35: public Object locateBean(String path) {
36: return beans.get(path);
37: }
38:
39: public void clear() {
40: beans.clear();
41: }
42: }
|