MentaContainer

Compare Revisions

Ignore whitespace Rev 96 → Rev 97

/trunk/src/main/java/org/mentacontainer/impl/MentaContainer.java
14,7 → 14,6
import org.mentacontainer.Factory;
import org.mentacontainer.Interceptable;
import org.mentacontainer.Scope;
import org.mentacontainer.SetterDependency;
import org.mentacontainer.util.InjectionUtils;
import org.mentacontainer.util.InjectionUtils.Provider;
 
35,8 → 34,10
private Map<String, ThreadLocal<Object>> threadLocalsCache = new Hashtable<String, ThreadLocal<Object>>();
private Set<SetterDependency> dependencies = Collections.synchronizedSet(new HashSet<SetterDependency>());
private Set<SetterDependency> setterDependencies = Collections.synchronizedSet(new HashSet<SetterDependency>());
private Set<ConstructorDependency> constructorDependencies = Collections.synchronizedSet(new HashSet<ConstructorDependency>());
@Override
public Class<? extends Object> getType(String key) {
308,7 → 309,7
 
if (target != null) {
 
for (SetterDependency d : dependencies) {
for (SetterDependency d : setterDependencies) {
 
// has dependency ?
Method m = d.check(target.getClass());
422,22 → 423,35
}
 
@Override
public SetterDependency autowireBySetter(String targetProperty, String sourceFromContainer) {
public void autowireBySetter(String targetProperty, String sourceFromContainer) {
Class<? extends Object> sourceType = getType(sourceFromContainer);
 
SetterDependency d = new SetterDependency(targetProperty, sourceFromContainer, sourceType);
dependencies.add(d);
 
return d;
setterDependencies.add(d);
}
@Override
public SetterDependency autowireBySetter(String targetProperty) {
public void autowireBySetter(String targetProperty) {
return autowireBySetter(targetProperty, targetProperty);
autowireBySetter(targetProperty, targetProperty);
}
@Override
public void autowireByConstructor(String sourceFromContainer) {
Class<? extends Object> sourceType = getType(sourceFromContainer);
ConstructorDependency d = new ConstructorDependency(sourceFromContainer, sourceType);
constructorDependencies.add(d);
}
Set<ConstructorDependency> getConstructorDependencies() {
return constructorDependencies;
}
 
@Override
public Container populate(Object bean) {