MentaContainer

Compare Revisions

Ignore whitespace Rev 3 → Rev 4

/trunk/src/main/java/org/mentacontainer/impl/Dependency.java
17,8 → 17,6
private Map<String, Method> cache = new HashMap<String, Method>();
private Map<Object, Object> received = new WeakHashMap<Object, Object>();
public Dependency(String target, Class<? extends Object> klass, String source) {
this.klass = klass;
105,30 → 103,4
 
return null;
}
/*
* Check if this object has already received the dependency, because we don't want to
* inject every time. Injecting just once is the correct behavior.
*/
public boolean hasAlreadyReceived(Object target) {
 
synchronized(received) {
 
return received.containsKey(target);
 
}
}
/*
* Flag that this object has already received the dependency.
*/
public void setAlreadyReceived(Object target) {
 
synchronized(received) {
 
received.put(target, null);
 
}
}
 
}