/** * Gets the key of this key's provider. */ Key<Provider<T>> providerKey() { return ofType(typeLiteral.providerType()); }
/** * Creates a synthetic binding to {@code Provider<T>}, i.e. a binding to the provider from * {@code Binding<T>}. */ private <T> BindingImpl<Provider<T>> createProviderBinding(Key<Provider<T>> key, Errors errors) throws ErrorsException { Type providerType = key.getTypeLiteral().getType(); // If the Provider has no type parameter (raw Provider)... if (!(providerType instanceof ParameterizedType)) { throw errors.cannotInjectRawProvider().toException(); } Type entryType = ((ParameterizedType) providerType).getActualTypeArguments()[0]; @SuppressWarnings("unchecked") // safe because T came from Key<Provider<T>> Key<T> providedKey = (Key<T>) key.ofType(entryType); BindingImpl<T> delegate = getBindingOrThrow(providedKey, errors); return new ProviderBindingImpl<>(this, key, delegate); }
throws ErrorsException { Key<String> stringKey = key.ofType(String.class); BindingImpl<String> stringBinding = state.getExplicitBinding(stringKey); if (stringBinding == null || !stringBinding.isConstant()) {
/** * Gets the key of this key's provider. */ Key<Provider<T>> providerKey() { return ofType(typeLiteral.providerType()); }
/** * Gets the key of this key's provider. */ Key<Provider<T>> providerKey() { return ofType(typeLiteral.providerType()); }
/** * Gets the key of this key's provider. */ Key<Provider<T>> providerKey() { return ofType(typeLiteral.providerType()); }
/** * Gets the key of this key's provider. */ Key<Provider<T>> providerKey() { return ofType(typeLiteral.providerType()); }
/** * Creates a synthetic binding to {@code Provider<T>}, i.e. a binding to the provider from * {@code Binding<T>}. */ private <T> BindingImpl<Provider<T>> createProviderBinding(Key<Provider<T>> key, Errors errors) throws ErrorsException { Type providerType = key.getTypeLiteral().getType(); // If the Provider has no type parameter (raw Provider)... if (!(providerType instanceof ParameterizedType)) { throw errors.cannotInjectRawProvider().toException(); } Type entryType = ((ParameterizedType) providerType).getActualTypeArguments()[0]; @SuppressWarnings("unchecked") // safe because T came from Key<Provider<T>> Key<T> providedKey = (Key<T>) key.ofType(entryType); BindingImpl<T> delegate = getBindingOrThrow(providedKey, errors); return new ProviderBindingImpl<>(this, key, delegate); }
/** * Creates a synthetic binding to {@code Provider<T>}, i.e. a binding to the provider from * {@code Binding<T>}. */ private <T> BindingImpl<Provider<T>> createProviderBinding(Key<Provider<T>> key, Errors errors) throws ErrorsException { Type providerType = key.getTypeLiteral().getType(); // If the Provider has no type parameter (raw Provider)... if (!(providerType instanceof ParameterizedType)) { throw errors.cannotInjectRawProvider().toException(); } Type entryType = ((ParameterizedType) providerType).getActualTypeArguments()[0]; @SuppressWarnings("unchecked") // safe because T came from Key<Provider<T>> Key<T> providedKey = (Key<T>) key.ofType(entryType); BindingImpl<T> delegate = getBindingOrThrow(providedKey, errors); return new ProviderBindingImpl<>(this, key, delegate); }
/** * Creates a synthetic binding to {@code Provider<T>}, i.e. a binding to the provider from * {@code Binding<T>}. */ private <T> BindingImpl<Provider<T>> createProviderBinding(Key<Provider<T>> key, Errors errors) throws ErrorsException { Type providerType = key.getTypeLiteral().getType(); // If the Provider has no type parameter (raw Provider)... if (!(providerType instanceof ParameterizedType)) { throw errors.cannotInjectRawProvider().toException(); } Type entryType = ((ParameterizedType) providerType).getActualTypeArguments()[0]; @SuppressWarnings("unchecked") // safe because T came from Key<Provider<T>> Key<T> providedKey = (Key<T>) key.ofType(entryType); BindingImpl<T> delegate = getBindingOrThrow(providedKey, errors); return new ProviderBindingImpl<>(this, key, delegate); }
/** * Creates a synthetic binding to {@code Provider<T>}, i.e. a binding to the provider from * {@code Binding<T>}. */ private <T> BindingImpl<Provider<T>> createProviderBinding(Key<Provider<T>> key, Errors errors) throws ErrorsException { Type providerType = key.getTypeLiteral().getType(); // If the Provider has no type parameter (raw Provider)... if (!(providerType instanceof ParameterizedType)) { throw errors.cannotInjectRawProvider().toException(); } Type entryType = ((ParameterizedType) providerType).getActualTypeArguments()[0]; @SuppressWarnings("unchecked") // safe because T came from Key<Provider<T>> Key<T> providedKey = (Key<T>) key.ofType(entryType); BindingImpl<T> delegate = getBindingOrThrow(providedKey, errors); return new ProviderBindingImpl<>(this, key, delegate); }
throws ErrorsException { Key<String> stringKey = key.ofType(String.class); BindingImpl<String> stringBinding = state.getExplicitBinding(stringKey); if (stringBinding == null || !stringBinding.isConstant()) {
throws ErrorsException { Key<String> stringKey = key.ofType(String.class); BindingImpl<String> stringBinding = state.getExplicitBinding(stringKey); if (stringBinding == null || !stringBinding.isConstant()) {
throws ErrorsException { Key<String> stringKey = key.ofType(String.class); BindingImpl<String> stringBinding = state.getExplicitBinding(stringKey); if (stringBinding == null || !stringBinding.isConstant()) {
throws ErrorsException { Key<String> stringKey = key.ofType(String.class); BindingImpl<String> stringBinding = state.getExplicitBinding(stringKey); if (stringBinding == null || !stringBinding.isConstant()) {