"alesj" wrote :
| How do you use this with attributes?
|
JBossXB will do it automatically.
1) attribute qName="urn:jboss:deployer-beans:2.0:option"
2) type qName="urn:jboss:deployer-beans:2.0:optionType"
3) convert to an object according to the config on that TypeBinding i.e. the ValueAdapter
But looking again, the problem is that we aren't using the AttributeBinding callback
for
these, we're looking at the attributes directly which are just strings. :-(
See DefaultElementHandler
|
| // Don't override this
| public void attributes(Object o, QName elementName, ElementBinding element,
Attributes attrs, NamespaceContext nsCtx)
| {
| if(attrsHandler != null)
| {
| attrsHandler.attributes(o, elementName, element.getType(), attrs, nsCtx);
| }
| }
|
| // Set an attribute handler on the constructor
| public DefaultElementHandler(AttributesHandler attrsHandler)
| {
| this.attrsHandler = attrsHandler;
| }
|
i.e.
|
| public class MyAttributeHandler extends AttributeHander
| {
| public void attribute(QName elemName,
| QName attrName,
| AttributeBinding binding,
| Object owner,
| Object value)
| {
| AbstractInjectionValueMetaData injection = (AbstractInjectionValueMetaData)
owner;
|
| String localName = attrName.getLocalPart();
| ...
| else if ("type".equals(localName))
| injection.setInjectionType((AutowireType) value)
| }
| }
|
But I'm not sure it is worth doing all this work, since these classes are going away
soon.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4134908#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...