"adrian(a)jboss.org" wrote : I don't understand why there is an InjectOption
and an InjectionOption?
|
The non enum version was first added.
But when the annotation support kicked in, I didn't want to rely on the String, so the
enum was added, but the old one was never removed. :-(
You can also see that the FromContext suffers from the same syndrome.
Where Inject(ion)Option should really be enum, since it only has finite number of usages,
the FromContext due to its Dynamic case cannot be.
So, it the case you use annotations, you cannot get the DynamicFromContext.
The non-enum FromContext is really an impl detail.
And perhaps to avoid confusion, it can be renamed.
"adrian(a)jboss.org" wrote :
| All of these should just be enums throughout
|
| Cardinality
| FromContext
| InjectionOption (already is InjectOption???)
| AutowireType
|
The Cardinality and FromContext cannot be enums.
The Cardinality can be whatever, not just those 4 usual usages.
e.g. 2..7, 5..n, etc
For FromContext see DynamicFromContext.
"adrian(a)jboss.org" wrote :
| Since we are doing 2.0.0 we could also decde to change ControllerMode to an Enum as
well?
|
Since I'll change a few of them anyway, I don't see why not this one as well.
"adrian(a)jboss.org" wrote :
| Also the FromContext is a misuse of generics.
| The purpose of generics is to produce compile time errors, the way this class is used,
it is simply not possible for the compiler to do so.
|
| It looks to me like the generic is only here to avoid having to manually code the
check/cast of ControllerContext -> KernelControllerContext
| but you should do that by hand anyway to give a better error message than CCE.
|
I'm already doing validation, so the error msg is useful.
But you're right, this is a misuse. A handy one, but a misuse. :-)
I'll remove the generics.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4134782#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...