1 2 Previous Next 23 Replies Latest reply on Oct 27, 2008 6:17 AM by Eric H

    New article on @Unwrap and @Factory annotations

    Eric H Novice

      I just wrote this article on using @Factory, @Unwrap and @Out.  I haven't linked it in yet.  I wrote it because the differences between these things can get rather confusing.  Any comments on this?  Any mistakes in there?

        • 1. Re: New article on @Unwrap and @Factory annotations
          Joshua Jackson Master

          Really good article. :-)
          You might want to put a link on the wiki for this.

          • 2. Re: New article on @Unwrap and @Factory annotations
            Guillaume Jeudy Master

            Nice article but some of the wording you use is confusing.


            When you want to explain that a variable gets published to a seam context you have to use the word outject not inject.


            The inject word means in Seam terminology that you are injecting variables from the context into your seam component.

            • 3. Re: New article on @Unwrap and @Factory annotations
              Francisco Jose Peredo Noguez Master

              I also liked the article, but I agree with Guillaume Jeudy:



              When you want to explain that a variable gets published to a seam context you have to use the word outject not inject.
              • 4. Re: New article on @Unwrap and @Factory annotations
                Eric H Novice

                Thanks for the point on that.  Although, are you sure outject is the right word to use here?  When a Seam variable is created using @Unwrap, do we really say it was outjected?  Wouldn't the word be inserted into a context?

                • 5. Re: New article on @Unwrap and @Factory annotations
                  Christian Bauer Master

                  Sorry Francisco, I accidentally deleted your posting... I was trying to delete only the duplicate.

                  • 6. Re: New article on @Unwrap and @Factory annotations
                    Francisco Jose Peredo Noguez Master

                    Grrrrrrr... ;-)


                    Do not worry, I'll post a similar one later. :-D

                    • 7. Re: New article on @Unwrap and @Factory annotations
                      Francisco Jose Peredo Noguez Master

                      Okey, here it goes again, in your article you wrote:



                      @Unwrap is for simple cases where a component needs to be injected into a context, and the class that does the managing doesn't need to be accessible.


                      You could write (but it would be wrong, not sure if redundant or contradictory):



                      @Unwrap is for simple cases where a component needs to be outjected into a context, and the class that does the managing doesn't need to be accessible.



                      But the right thing to write would be:



                      @Unwrap is for simple cases where a component needs to be outjected, and the class that does the managing doesn't need to be accessible.


                      Here is why (4.3 Bijection):



                      bidirectional - values are injected from context variables into attributes of the component being invoked, and also outjected from the component attributes back out to the context, allowing the component being invoked to manipulate the values of contextual variables simply by setting its own instance variables


                      I think that means that you should use the word outject when you take stuff from components and put it the context, and the word inject when you take stuff from the context and put it a component.


                      Do you agree?


                      • 8. Re: New article on @Unwrap and @Factory annotations
                        Francisco Jose Peredo Noguez Master

                        Oh, and something I forgot to write this second time:


                        It would be, of course, important to first explain in your article, the meaning of the words outject and inject.

                        • 9. Re: New article on @Unwrap and @Factory annotations
                          Eric H Novice

                          Ok, thanks for the suggestion.  I'll re-word it.  And of course, I'll need to add an explanation of outjection and Seam contexts.


                          Another question: imagine a very simple component like this:


                          @Name("bob") public class Bob {
                            public String getHello() { return "Hi, I'm Bob!"; }
                          }



                          Would you really say that this is outjected?  Perhaps you could, because the Seam loader is outjecting it when the JAR file is scanned?  Or is there some other word?  I would almost say, inserted into the context.


                          The reason I'm making a distinction here is because to me, outject implies @Out, while all the other ways of putting something into Seam context maybe should use some other word?

                          • 10. Re: New article on @Unwrap and @Factory annotations
                            Francisco Jose Peredo Noguez Master

                            Eric H wrote on Oct 10, 2008 21:21:


                            Ok, thanks for the suggestion.  I'll re-word it.  And of course, I'll need to add an explanation of outjection and Seam contexts.

                            Another question: imagine a very simple component like this:

                            @Name("bob") public class Bob {
                              public String getHello() { return "Hi, I'm Bob!"; }
                            }



                            Would you really say that this is outjected?



                            I guess by this you mean the bob component?



                            Perhaps you could, because the Seam loader is outjecting it when the JAR file is scanned?  Or is there some other word?  I would almost say, inserted into the context.



                            Not sure, but I guess that the right word would be outjected, it is not that inserted is wrong, it is just that outjected is... i don't know, a better fit? like the difference between saying Cranio-encephalic traumatism and saying hit in the head.


                            The reason I'm making a distinction here is because to me, outject implies @Out, while all the other ways of putting something into Seam context maybe should use some other word?


                            Perhaps you are right... but I think outject would be the best word to use... Of course it would be nice if someone from the Seam team (or Dan Allen the author of Seam in Action) could give their opinion...



                            • 11. Re: New article on @Unwrap and @Factory annotations
                              Eric H Novice

                              Francisco Peredo wrote on Oct 10, 2008 21:30:


                              Of course it would be nice if someone from the Seam team (or Dan Allen the author of Seam in Action) could give their opinion...


                              Yes.  I'm happy to call it anything we want to call it (georgina, or strapflomation, or anything else), but I would like some guidance so that everyone could use consistent terms to prevent readers from being confused.

                              • 12. Re: New article on @Unwrap and @Factory annotations
                                Francisco Jose Peredo Noguez Master

                                Forget everything I wrote, I definitely think you should write ;-):




                                @Unwrap is for simple cases where a component needs to be strapflomationed, and the class that does the managing doesn't need to be accessible.

                                • 13. Re: New article on @Unwrap and @Factory annotations
                                  Pete Muir Master

                                  Eric H wrote on Oct 10, 2008 20:23:


                                  Thanks for the point on that.  Although, are you sure outject is the right word to use here?  When a Seam variable is created using @Unwrap, do we really say it was outjected?  Wouldn't the word be inserted into a context?


                                  When @Unwrap is called (unlike @Factory) the value isn't stored in any context, but returned directly (the @Unwrap method is called every time the variable is accessed. So it's definitely not outjected, and neither is it inserted. You could say it exposes...

                                  • 14. Re: New article on @Unwrap and @Factory annotations
                                    Pete Muir Master

                                    Eric H wrote on Oct 10, 2008 21:21:


                                    Ok, thanks for the suggestion.  I'll re-word it.  And of course, I'll need to add an explanation of outjection and Seam contexts.

                                    Another question: imagine a very simple component like this:

                                    @Name("bob") public class Bob {
                                      public String getHello() { return "Hi, I'm Bob!"; }
                                    }



                                    Would you really say that this is outjected?  Perhaps you could, because the Seam loader is outjecting it when the JAR file is scanned?  Or is there some other word?  I would almost say, inserted into the context.

                                    The reason I'm making a distinction here is because to me, outject implies @Out, while all the other ways of putting something into Seam context maybe should use some other word?


                                    I only ever say something is outjected if it's set into the context using @Out or @Factory, but in general I prefer to use something like stored in the context or aliased from the context.

                                    1 2 Previous Next