Hi.
So i realize this is a kind of circular dependency.
How do you all go about taking a serial DI chain that takes an input and
output?
The only method i've been able to come up with is sticking a session scope
object at the top of each chain so I can pass it a global value as an input
for it to send down the chain. This seems like an awful practice.
On Thursday, March 28, 2013 8:19:46 AM UTC-7, caseybasichis wrote:
>
> Hi,
>
> class E {
> public:
> E(D);
> setLeafData(AData);
> getE();
> };
>
> class D {
> public:
> D(C)
> ..
>
> class A {
> public:
> A();
> setAData(AData)
> getAData()
> }
>
> myE = inject->E
>
> myE.setLeafData("blah")
> myE.getE();
>
> Here is a basic idea. It's not Java, but the concept is a fundamental
> question.
>
> On Thursday, March 28, 2013 7:52:05 AM UTC-7, Fred Faber wrote:
>>
>> Could you sketch a quick concrete example to show this in code real quick?
>>
>> On Thu, Mar 28, 2013 at 10:29 AM, caseybasichis <[email protected]>wrote:
>>
>>> Hi,
>>>
>>> I am struggling to understand how to give parameter information to leaf
>>> nodes, from the root node in a DI setup similar to Guice.
>>>
>>> I have a class that takes a set of A's and generates E's.
>>> (E(D(C(B(A)))))
>>>
>>> E is the injected, the rest are instantiated by the DI, A is an 'A
>>> provider' or 'A factory'
>>>
>>> E is the interface, how can I get a path, or other const data from a
>>> function in E to A, to start the function chain?
>>>
>>> In other words I have some simple data A, that gets processed through a
>>> function chain, down to an E class which generates an E_Data object which
>>> is then used in the root of my application.
>>>
>>> Do I string functions through E,D,C,B to get A's reference? That seems
>>> wrong.
>>>
>>> Reversing the chain make the path simple A(B(C(D(E))))), but the only
>>> way to get the output seems to be to attach a singleton to E like
>>> A(B(C(D(E(SQL)))))).
>>>
>>> That seems like inversion-of-inversion of control, but it also seems
>>> like a data manager could be made at the session scope that E could take as
>>> a constructor.
>>>
>>> What do I have flipped?
>>>
>>> Thanks,
>>>
>>> Casey
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "google-guice" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at http://groups.google.com/group/google-guice?hl=en.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>
--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.