-
-
2. Re: CDI API JavaDocs
asookazian Nov 10, 2009 7:15 PM (in response to asookazian)sticky this one, plz.
-
3. Re: CDI API JavaDocs
asookazian Nov 10, 2009 7:39 PM (in response to asookazian)So here is an example of @Produces from the API doc:
public class Shop { @Produces @ApplicationScoped @Catalog @Named("catalog") List<Product> getProducts() { ... } ... }
http://docs.jboss.org/cdi/api/1.0/javax/enterprise/inject/Produces.html
So what do all these annotations mean?
@Produces marks getProducts() as a producer method (
a producer method acts as a source of objects to be injected
).So is the List application scoped? According to the API doc:
Specifies that a bean is application scoped.
Ok, so why is the method target allowed? Shouldn't it just be target of type only?What is @Catalog? Is that a custom annotation or stereotype? I don't see it in the API doc. I don't see @Named either in the API doc.
I see now after reading the spec:
A producer method may also specify scope, name, stereotypes and/or qualifiers.
Even though it may be flexible and powerful to use these annotations (and this many of them simultaneously on the same method), it makes it more difficult to
swallow
the intent or meaning of this metadata for this particular method, no? At least when you're first learning 299/Weld. Learning curve gets steeper. -
4. Re: CDI API JavaDocs
gavin.king Nov 10, 2009 8:02 PM (in response to asookazian)What precisely is the point of this post? To prove to us that you need to read the documentation?
Learning curve gets steeper.I hope so. A steep curve means you to a higher place, faster.
-
5. Re: CDI API JavaDocs
asookazian Nov 10, 2009 10:49 PM (in response to asookazian)
Gavin King wrote on Nov 10, 2009 20:02:
A steep curve means you to a higher place, faster.Completely disagree. Unless you have wings. Gravity makes things harder, just like hiking up Mt. Everest for 5 mi rather than walking on a flat road for 5 mi.
Learning curve
for Everest is steeper.The whole point of design patterns like intercptors, factory, MVC, singleton, DI/IOC is to make our lives as architects and developers ultimately easier and give us more powerful and flexible solutions/frameworks to work with in our tool set. But you have to learn the concepts first and then how/when/why to use them in real world apps...
I guess the bottom line is this: if you want a robust, powerful and flexible framework, there will always be a learning curve. If a framework surfaces that is very easy to learn and use right off the bat, but is still robust and flexible, I'd be very surprised...
-
6. Re: CDI API JavaDocs
pmuir Nov 12, 2009 7:15 PM (in response to asookazian)
Arbi Sookazian wrote on Nov 10, 2009 22:49:
Gavin King wrote on Nov 10, 2009 20:02:
A steep curve means you to a higher place, faster.
Completely disagree. Unless you have wings. Gravity makes things harder, just like hiking up Mt. Everest for 5 mi rather than walking on a flat road for 5 mi.Learning curve
for Everest is steeper.Actually, as a vaguely experienced mountaineer, I can tell you that having wings wouldn't make the ascent of Everest any easier or harder. What makes a mountain the size of Everest hard is not the vertical distance climbed, or the energy used to it, but the lower air pressure (which can cause edemas) and the weather. I can quite happily ascend 2500m (or greater than a quarter of the height of Everest) in under 24 hours (I have a friend who has done 3000m in a day!). But I digres.
-
7. Re: CDI API JavaDocs
asookazian Nov 12, 2009 7:53 PM (in response to asookazian)No way in hell you'll see me climb anything other than a smallish tree :)