[Design the new POJO MicroContainer] - Re: Bean instantiate order with contextual injection
by adrian@jboss.org
"alesj" wrote :
| Ok, forget then about 'placeholder' approach?
|
Yes. It was only a temporary solution so you wouldn't have
to mess around with the visitor.
anonymous wrote :
| Calling revisit from where - ConfiguredAction - though AbstractKernelCOntrollerContext?
|
>From the DescribeAction.
| BeanMetaData metaData = context.getBeanMetaData();
| if (metaData.getBean() != null)
| {
| BeanInfo info = configurator.getBeanInfo(metaData);
| context.setBeanInfo(info);
|
| <snipped/>
|
| describeMetaData(); // similar to preprocessMetaData();
| }
|
The first visit is to read the metadata that can be determined
without the classloader/class (which up until now has been
all of it except the AOP stuff).
The second visit is once the class is resolved and the BeanInfo
is available.
| public interface MetaDataVisitor[Node]
| {
| void initialVisit(...); // the original visit(...)
| void describeVisit(...);
| }
|
You can then do all your processing in the describe visit
knowing that context.getBeanInfo() will be available.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3965250#3965250
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3965250
19 years, 7 months
[Design the new POJO MicroContainer] - Re: Bean instantiate order with contextual injection
by alesj
"adrian(a)jboss.org" wrote : The alternative which is to fix it up by hand in the DescribeAction
| (like you are doing now with the placeholder) is not very extensible
| going forwards. It really needs a visitor pattern.
Ok, forget then about 'placeholder' approach?
Rewrite it to revisit pattern + anonymous wrote : Of course, every metadata class that takes part in this would need
| to implement an interface that defines the getType(),
|
| e.g. based on what was retrieved from the stack
| advmd -> (NewInterface) propertyMetaData.getType()
| advmd -> (NewInterface) parameterMetaData.getType() -> (NewInterface) constructor.getType()
|
| Also, for the parameters, there would need to be some notion
| of "index" so you know which parameter you are working with.?
Calling revisit from where - ConfiguredAction - though AbstractKernelCOntrollerContext?
public void setController(Controller controller)
| {
| super.setController(controller);
| preprocessMetaData();
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3965244#3965244
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3965244
19 years, 7 months
[Design the new POJO MicroContainer] - Re: Bean instantiate order with contextual injection
by adrian@jboss.org
"alesj" wrote : Is there a view of all possible usage?
|
You mean besides the xsd? :-)
anonymous wrote :
| So that I know where and how to look for useful injection information in this MetaData stack.
I don't know how you would define something abstract.
The information you want comes from the BeanInfo
not the MetaData. The MetaData is just the key.
e.g. className + property name -> getBeanInfo(className).getProperty(name).getType();
It is even more complicated for parameters since then you
have to iterate to constructors and do a "fuzzy match"
to try to guess which constructor they mean.
The current logic is in the Configurator for matching joinpoints.
My guess would be that you would need to:
1) Implement the revisit() of the meta data such that
you have the metadata context after the BeanInfo has been
determined. a simple way to be to add a visitDescribed() path.
2) The ADVMD then asks its parent on the stack getClass();
which will for a property
3a) Do context.getBeanInfo().getProperty(myName) and return the type
for a parameter
4a) Ask the constructor/beanMetaData to guess which constructor
will be used from the BeanInfo.getConstructors() and then
determine the class from this.
The factory and create/.../destroy/install will be the same as the
constructor except at least for the factory/install they will have
to retrieve the bean info for a different type.
Again all this code is in the Configurator in terms of resolving/guessing
the specific info.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3965238#3965238
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3965238
19 years, 7 months