return new LazyBinding<Object>(key, requiredBy, classLoader, lazyKey);
/** * Creates a just-in-time binding for the key in {@code deferred}. The type of binding * to be created depends on the key's type: * <ul> * <li>Injections of {@code Provider<Foo>}, {@code MembersInjector<Bar>}, and * {@code Lazy<Blah>} will delegate to the bindings of {@code Foo}, {@code Bar}, and * {@code Blah} respectively. * <li>Injections of other types will use the injectable constructors of those classes. * </ul> */ private Binding<?> createJitBinding(String key, Object requiredBy, boolean mustBeInjectable) throws ClassNotFoundException { String builtInBindingsKey = Keys.getBuiltInBindingsKey(key); if (builtInBindingsKey != null) { return new BuiltInBinding<Object>(key, requiredBy, builtInBindingsKey); } String lazyKey = Keys.getLazyKey(key); if (lazyKey != null) { return new LazyBinding<Object>(key, requiredBy, lazyKey); } String className = Keys.getClassName(key); if (className != null && !Keys.isAnnotated(key)) { Binding<?> atInjectBinding = plugin.getAtInjectBinding(key, className, mustBeInjectable); if (atInjectBinding != null) { return atInjectBinding; } } throw new IllegalArgumentException("No binding for " + key); }