-
1. Re: Composition and Seam-Components
cash1981 Sep 11, 2009 2:22 PM (in response to chrisb76)Hello Christian. Welcome to the forum.
I do not fully understand what you want. However I have some comments on the above code. First of all, it seems you have injecting
@In Object a; in class A with name a. Are you sure this is correct? I believe you want to inject b into a and inject a into b? Like this:
@Name("b") Class B implements I { @In(create = true) A a; public void doSomething() { sysout(b.toString); } }
If you want to use A and B class in your component Something, you can just inject them
@Name("seamComponent") class seamComponent { @In(create = true) A a; @In(create = true) B b; I composition; public setComposition(I aCompositonObject) { composition = aCompositonObject; } public go() { composition.doSomething() } }
I am not sure what the I composition is here. Try reading the documentation on seam to fully understand the bi-jection.
-
2. Re: Composition and Seam-Components
chrisb76 Sep 14, 2009 8:28 AM (in response to chrisb76)Hey Shervin,
thx for the quick reply!
Shervin Asgari wrote on Sep 11, 2009 14:22:
@In Object a; in class A with name a. Are you sure this is correct? I believe you want to inject b into a and inject a into b? Like this:@Name("b") Class B implements I { @In(create = true) A a; public void doSomething() { sysout(b.toString); } }
If you want to use A and B class in your component Something, you can just inject them@Name("seamComponent") class seamComponent { @In(create = true) A a; @In(create = true) B b; I composition; public setComposition(I aCompositonObject) { composition = aCompositonObject; } public go() { composition.doSomething() } }
I am not sure what the I composition is here. Try reading the documentation on seam to fully understand the bi-jection.The Objects in Class A and Class B really dont matters.
I just wanted to show some differentBusinessLogic
...I don't want to inject both classes and any further implementation of the interface. It is more inject class A OR class B (or Class C...). Any of the developers can implement the interface if the functions provided in the standard-implementation doesnt fit. Is there a way to do this in seam without coding in the class 'seamComponent' ?
Click HELP for text formatting instructions. Then edit this text and check the preview. -
3. Re: Composition and Seam-Components
trunikov.dmitry.trunikov.zoral.com.ua Sep 14, 2009 8:38 AM (in response to chrisb76)Hi Christian,
I perceive your issue. May be you should take a look on @Factory annotation.