Questions tagged [assisted-inject]

61 questions
3
votes
1 answer

Guice, FactoryModuleBuilder, multiple implementations, and generics

I am using Guice and FactoryModuleBuilder. Typically, it is enough to just define an interface of the factory and Guice will automatically inject the implementation. However, the part that I am struggling is that the methods in a factory uses…
Christopher Z
  • 899
  • 1
  • 12
  • 32
3
votes
1 answer

Using Assisted Inject with FactoryModuleBuilder in guice - Factory injection not being done

I am a guice newbie trying to figure out how to implement assisted inject in the guice using FactoryModuleBuilder. I consulted the guice java docs for implementing FactoryModuleBuilder. I have done everything exactly as it says in the docs. Its not…
sachi1325
  • 45
  • 1
  • 6
3
votes
1 answer

GIN AssistedInject issue with factory "Unable to create or inherit binding"

I am getting an strange error which I cannot get past when using Assisted Injection: [DEBUG] [project] - Rebinding com.gwtplatform.mvp.client.DesktopGinjector [DEBUG] [project] - Invoking generator com.google.gwt.inject.rebind.GinjectorGenerator …
Casey Jordan
  • 1,204
  • 1
  • 20
  • 39
3
votes
1 answer

@Nullable doesn't seem to work with @AssistedInject

I have a constructor that looks like this: @Inject public MyClass( @Named("config") String configFile, @Named("template") String templateFile, CachedSettings settings, @Assisted String channelId, @Nullable…
durron597
  • 31,968
  • 17
  • 99
  • 158
2
votes
0 answers

Dagger2. How to use multibinding with supporting of assisted injection?

I have an interface PaymentProvider: interface PaymentProvider { fun pay(amount: Double): Boolean } Here is different implementations: class PayPalPayment @AssistedInject constructor( private val payPalRepo: PayPalRepository, @Assisted…
testivanivan
  • 967
  • 13
  • 36
2
votes
0 answers

Guice Assisted Inject - java.lang.IllegalStateException: zip file closed

I'm having problems with using Guice's assisted inject within my spigot plugin, and can't seem to narrow down the problem. This is the error I'm getting: > [12:00:38 INFO]: [DestinyMC] Enabling DestinyMC v1.0 > 2019-01-14 12:00:41,492…
Pwnion
  • 21
  • 3
2
votes
1 answer

How to use Guice AssistedInject with multiple implementations of an interface?

I'm having trouble finding how to have a "dynamic AssistedInject". What i mean by that is i would like to provide to the factory the implementing class name it needs to use at runtime based on a parameter. Here's what i currently have: interface…
Crystark
  • 3,693
  • 5
  • 40
  • 61
2
votes
0 answers

Error during injecting Context in AsyncTask using Guice Assisted Inject Factory

I'm creating Android project using RoboGuice 2.0 with help from Guice Extension - Assisted Inject. Right now I'm facing problem with injecting Context via factory on non UI thread. Sample Project with show my issue: Person interface: public…
pawelbial
  • 997
  • 1
  • 10
  • 15
2
votes
1 answer

Gin AssistedInject: Deferred binding result type 'Foo' should not be abstract

I'm trying to use AssistedInject with Gin in GWT 2.4.0: public interface ElevatorButtonFactory { ElevatorButton create(int shownFloorNumber, Action onClick); } @Inject ElevatorButton(GameHost gameHost, @Assisted int…
Nick Heiner
  • 119,074
  • 188
  • 476
  • 699
1
vote
0 answers

Assisted Injection with Hilt in Jetpack Compose multi module app

I am having some trouble with assisted Injection in Hilt and Jetpack Compose. I have set stuff up like here https://medium.com/scalereal/providing-assistedinject-supported-viewmodel-for-composable-using-hilt-ae973632e29a Just for the sake of it...…
1
vote
0 answers

Hilt - Assisted Injection

I have factory @AssistedFactory interface SetNumberUseCaseFactory { fun create(listener: UpdateFrontData, exercisedWithSetsDTO: MutableList, setEntitiesList: MutableList):…
RCH
  • 1,247
  • 1
  • 11
  • 16
1
vote
1 answer

@AssistedInject parameters in Hilt modules

I'm having trouble migrating a project from Dagger to Hilt. The legacy code uses a class Foo that has configuration for the app itself (like country code and such), an instance of this Foo class is retrieved after the user chooses a region from a…
1
vote
1 answer

How does Dagger2's built-in AssistedInject support factories that return interfaces instead of classes

I'm poking around with Dagger2 and its built-in AssisedInject annotation. The tutorial available at dagger.dev shows an example where the factory method returns a concrete class but I would have expected the factory to return an interface for which…
David
  • 11
  • 2
1
vote
1 answer

ClassNotFoundException on Worker class

I'm getting a lot of strange errors in production, that only happens to a few users, so 99% of users are okay. java.lang.Error: java.lang.ClassNotFoundException: com.packagename.core.Translations.TranslationWorker at…
Syntey
  • 147
  • 1
  • 15
1
vote
1 answer

How to Inject an object which is created with Assisted Injection in Guice?

I'm trying to pass an object which has a runtime variable into an other object. How can I achieve this using Guice? I'm new to dependency injection. I would like to create several A objects (the number of them is decided at runtime) and that many B…