1 package org.jfox.ioc; 2 3 import java.util.Collections ; 4 import java.util.HashMap ; 5 import java.util.Iterator ; 6 7 12 13 public class ComponentContext { 14 15 private String module; 16 17 20 private String moduleDesc; 21 22 25 private String moduleDir; 26 27 30 private boolean singleton; 31 32 35 private boolean typeSingleton; 36 37 40 private HashMap attributes = new HashMap (); 41 42 private Registry registry; 43 44 public ComponentContext() { 45 } 46 47 50 public String getModule() { 51 return module; 52 } 53 54 57 void setModule(String module) { 58 this.module = module; 59 } 60 61 public String getModuleDesc() { 62 return moduleDesc; 63 } 64 65 void setModuleDesc(String module) { 66 this.moduleDesc = module; 67 } 68 69 public String getModuleDir() { 70 return moduleDir; 71 } 72 73 void setModuleDir(String moduleDir) { 74 this.moduleDir = moduleDir; 75 } 76 77 public boolean isSingleton() { 78 return singleton; 79 } 80 81 void setSingleton(boolean singleton) { 82 this.singleton = singleton; 83 } 84 85 public boolean isTypeSingleton() { 86 return typeSingleton; 87 } 88 89 void setTypeSingleton(boolean typeSingleton) { 90 this.typeSingleton = typeSingleton; 91 } 92 93 96 public Iterator getAttributeNames() { 97 return Collections.unmodifiableMap(new HashMap (attributes)).keySet() 98 .iterator(); 99 } 100 101 107 public synchronized void setAttribute(String name, Object value) { 108 attributes.put(name, value); 109 } 110 111 117 public synchronized Object removeAttribute(String name) { 118 return attributes.remove(name); 119 } 120 121 127 public Object getAttribute(String name) { 128 return attributes.get(name); 129 } 130 131 public Registry getRegistry() { 132 return registry; 133 } 134 135 void setRegistry(Registry registry) { 136 this.registry = registry; 137 } 138 139 public static void main(String [] args) { 140 141 } 142 } 143 144 | Popular Tags |