"alesj" wrote : "adrian(a)jboss.org" wrote : "alesj" wrote :
| | | After you add new MetaData, it needs to be 'visited', in order to
plugin all those dependencies, callbacks, installs, ...
| | | So the easiest way for me to do that was to use the existing MetaDataVisitor
concept, and just twist it a bit to suite my need - not starting from BeanMetaData, but on
newly added MetaDataVisitorNode + pushing BMD at the bottom of the stack before executing
it.
| | |
| | Ok. But I'm not sure it needs to be this complicated?
| |
| Complicated?
| This is what looked natural to me, to use existing visitor concept.
| Since we are already in Describe state, executing both of them - initial and describe.
No need for changing existing MetaData impl.
| What would you do?
|
I don't know, but I'd try to find someway to avoid the isAlreadyDone()
that is bound to lead to confusion (and most likely errors).
The fundamental problem is that there are three points when we know that metadata
could be introduced and that is really complete.
1) Initial install - we know the xml (really BeanMetaData)
2) PreInstall - for a simple bean - we know the class (and we know it exists)
3) Instantiate - for a bean from a factory - it is only here we know the class
from object.getClass()
I'd find someway to make the retrieval lazy such that
steps 1 and 2 only look at the metadata they absolutely need to
and step 3 does the all rest (most of it).
e.g. You can't specify a classloader using an annotation
| @ClassLoader(name="Whatever")
| public class MyClass {}
|
because it couldn't load the class until the classloader exists
so it could never read the annotation.
That is an example of the MetaData that needs to be visited in step (1)
and the dependency constructed.
Others like property injection can be left to step 3 when we know
we have access to the full picture, i.e. we don't use the annotation
from the class if the xml/metadata has one.
This is also related to something I discussed with Carlo about ejb annotations.
The annotations in the xml are "instance scope" annotations,
while the annotations on the class are "Class scope" annotations.
Any "instance scope" annotation makes the "class scope" invisible.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4070696#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...