Questions tagged [assisted-inject]
61 questions
0
votes
1 answer
Android ViewModel has no zero argument constructor when calling .observe() on a sharedViewModel
I have the following classes:
The ViewModel
class MealPlanViewModel @AssistedInject constructor(private val mealPlanRepository: MealPlanRepository, @Assisted private val canteenId: String) : ViewModel() {
// AssistedInject code for using…

aglogger
- 1
0
votes
1 answer
Assisted inject to inject different dependencies based on runtime check
I have an application class "Application", one abstract class "AbstractClass" extended by "Impl1" and "Impl2".
The application class gets the impl1 or impl2 to perform some task based on the input it receives.
Currently I am injecting both the…

learning_to_write_good_code
- 123
- 1
- 2
- 8
0
votes
2 answers
Dagger injection to Workamanager AssistedInject_AppAssistedInjectModule
I want to inject repositories and others in the workmanager. Since workmanager is and Android Component i cannot just inject stuff in the construcotr but i have to make a Factory class. So i found an example on Medium and i followed it. I have the…

james04
- 1,580
- 2
- 20
- 46
0
votes
1 answer
What is Spring boot's version of @Assisted
I'm wondering how to convert Guice's @Assisted annotation into spring boot in Java. For example I have this code:
@Inject
public Merge(@Named(Conf.MkvFields.CHAININPUT_DELAY) String chainInputDelay,
@Named(Conf.MkvFields.REAL_TIME_PROCESSING),
…

sunalive
- 255
- 4
- 13
0
votes
0 answers
CDI - how to inject unmanaged dependencies like Guice's Assisted Inject
Guice has a nice extension called AssitedInject. Is there a way to realise auto-wired factories with CDI in Java EE? I want to be able to obtain managed instances that have managed as well as unmanaged dependencies.
Imagine a Command Pattern like…
user212926
0
votes
1 answer
Creating objects with AssistedInject Factory in Guice
I have a class that should be injected in two different ways:
for general purpose as singleton
customized version as RequestScoped.
Example:
public class TaskProcessorService implements TaskProcessor {
private final TaskRegistry taskRegistry;
…

Rychu
- 86
- 1
- 7
0
votes
1 answer
A binding to java.lang.String annotated with @com.google.inject.assistedinject.Assisted(value=) was already configured at TesterFactory.create()
import com.google.inject.assistedinject.Assisted;
public interface TesterFactory {
TesterResource create(@Assisted String serviceName, @Assisted String serviceType);
}
My TesterResource class has 2 members:
@Inject
@Assisted
private String…

user1692342
- 5,007
- 11
- 69
- 128
0
votes
1 answer
Guice: Assisted injections and providers
Suppose I have a class as follows:
public class ComplicatedImpl implements Complicated {
@Inject
public ComplicatedImpl(Integer normal, @Assisted String assisted);
public void addListener(Listener listener);
}
Now, I have a…

Kelvin Chung
- 1,327
- 1
- 11
- 23
0
votes
0 answers
Assisted-injection in Guice
I'd like some advise on the use of assisted injection.
Most of the example that i saw about assisted injection, have the following characteristic:
The class being constructor has a parameter, that comes one or more parameter that only comes at…

MaatDeamon
- 9,532
- 9
- 60
- 127
0
votes
1 answer
guice-assistedinject.jar in Eclipse target platform but not addable in plug-in's dependencies
I'm developing an Eclipse RCP application with Eclipse 4.4 Luna M5 and I'm using Guice 3.0.
So I added guice.jar to my target platform and for every plug-in I'm developing I can add bundle com.google.inject to the plug-in's dependencies using the…

user -27
- 33
- 5
0
votes
1 answer
Using assisted injection create a complex dependency tree
I have recently learned about the AssistedInject extension to Guice and I thought it would be a nice solution to some design issues that I have. Unfortunately it seems that this solution is limited to just a one level assisted injection. Here comes…

makasprzak
- 5,082
- 3
- 30
- 49
0
votes
1 answer
Build specific class in object graph with Guice
I am stuck in a situation where I decided early on not to create a specific graph with Guice. I need a factory, but I cannot figure out how to build it.
What I have achieved is a session aware game object management system.
All objects that need to…

AnthonyJClink
- 1,008
- 2
- 11
- 32
0
votes
1 answer
Which AssistedInject should I use? Google or Sonatype?
I am very new to Guice, and I need AssistedInject in my application. When I looked up the Jar on maven, I saw there were two:
org.sonatype.sisu.inject
com.google.inject.extensions
The Sonatype version is more recently updated and has a later…

durron597
- 31,968
- 17
- 99
- 158
0
votes
1 answer
Guice FactoryModuleBuilder for lists of inputs
I've used Guice assisted injection and FactoryModuleBuilder to help construct adapter classes, where one class wraps another.
class MyClassWrapper implements SomeInterface {
interface MyClassWrapper.Factory {
MyClassWrapper create(MyClass…

frankadelic
- 20,543
- 37
- 111
- 164
0
votes
1 answer
Inject the creation context into a guice managed instance via assisted injection
I'd like to be able to discover/inject the name of the method that created an object via assisted injection into the object that was created.
An example of what I want to do:
// what I want guice to create the implementation for this
interface…

Matt
- 722
- 10
- 20