add injectFields method to InstanceContainer to inject fields for existing instance

This commit is contained in:
yugecin 2017-03-04 13:59:23 +01:00
parent 92ce01acd0
commit c3e6826464
2 changed files with 6 additions and 0 deletions

View File

@ -101,6 +101,11 @@ public abstract class Injector implements InstanceContainer, Binder {
return object; return object;
} }
@Override
public <T> T injectFields(T obj) {
return injectFields(obj, obj.getClass());
}
public final <T> Binder<T> bind(Class<T> type) { public final <T> Binder<T> bind(Class<T> type) {
lastType = type; lastType = type;
return this; return this;

View File

@ -20,5 +20,6 @@ package yugecin.opsudance.core.inject;
public interface InstanceContainer { public interface InstanceContainer {
<T> T provide(Class<T> type); <T> T provide(Class<T> type);
<T> T injectFields(T instance);
} }