1 15 package org.apache.hivemind.service.impl; 16 17 import java.util.ArrayList ; 18 import java.util.HashMap ; 19 import java.util.Iterator ; 20 import java.util.List ; 21 import java.util.Map ; 22 23 import org.apache.hivemind.ServiceImplementationFactoryParameters; 24 import org.apache.hivemind.impl.BaseLocatable; 25 26 31 public class BuilderParameter extends BaseLocatable 32 { 33 private String _className; 34 35 private List _properties = new ArrayList (); 36 37 private List _parameters = new ArrayList (); 38 39 40 private Map _typeFacetMap = new HashMap (); 41 42 private List _events = new ArrayList (); 43 44 private String _initializeMethod; 45 46 private boolean _autowireServices; 47 48 public String getClassName() 49 { 50 return _className; 51 } 52 53 public void addParameter(BuilderFacet facet) 54 { 55 _parameters.add(facet); 56 } 57 58 public List getParameters() 59 { 60 return _parameters; 61 } 62 63 public void addProperty(BuilderFacet facet) 64 { 65 _properties.add(facet); 66 } 67 68 public List getProperties() 69 { 70 return _properties; 71 } 72 73 74 public BuilderFacet getFacetForType(ServiceImplementationFactoryParameters factoryParameters, 75 Class targetType) 76 { 77 BuilderFacet result = (BuilderFacet) _typeFacetMap.get(targetType); 78 79 if (result == null) 80 { 81 for (Iterator i = _properties.iterator(); i.hasNext();) 82 { 83 BuilderFacet facet = (BuilderFacet) i.next(); 84 85 if (facet.canAutowireConstructorParameter() 86 && facet.isAssignableToType(factoryParameters, targetType)) 87 { 88 result = facet; 89 break; 90 } 91 } 92 93 _typeFacetMap.put(targetType, result); 94 } 95 96 return result; 97 } 98 99 public void setClassName(String string) 100 { 101 _className = string; 102 } 103 104 public void addEventRegistration(EventRegistration registration) 105 { 106 _events.add(registration); 107 } 108 109 public List getEventRegistrations() 110 { 111 return _events; 112 } 113 114 public String getInitializeMethod() 115 { 116 return _initializeMethod; 117 } 118 119 public void setInitializeMethod(String string) 120 { 121 _initializeMethod = string; 122 } 123 124 public boolean getAutowireServices() 125 { 126 return _autowireServices; 127 } 128 129 public void setAutowireServices(boolean autowireServices) 130 { 131 _autowireServices = autowireServices; 132 } 133 134 } | Popular Tags |