From: <ad...@jb...> - 2005-05-11 19:46:06
|
I've figured out what the problem is with the expression of the Map and Key/Value. The issue is with the polymorphism, my attempts to reduce the verbosity of the xml and the parsing API. Essentially, the problem is that to get the polymorphism to work, I have to introduce a type binding, in this case key -> valueType value -> valueType where valueType can be collection/array/list/ANY/etc. But this then requires an extra object to be constructed to model the polymorphic behaviour: | // value binding | TypeBinding valueType = schemaBinding.getType(valueTypeQName); | | configureValueBindings(valueType); // <------ subelements | | valueType.setHandler(new DefaultElementHandler() | { | public Object startElement(Object parent, QName name, TypeBinding type) | { | return new AbstractValueMetaData(new StringValueMetaData()); | } | etc. | Then later I have to unwrap the extra AbstractValueMetaData | AbstractMapMetaData map = (AbstractMapMetaData) parent; | MapEntry entry = (MapEntry) child; | AbstractValueMetaData entryKey = (AbstractValueMetaData) entry.key; | if (entryKey == null) | throw new IllegalArgumentException("No key in map entry"); | AbstractValueMetaData entryValue = (AbstractValueMetaData) entry.value; | if (entryValue == null) | throw new IllegalArgumentException("No value in map entry"); | map.put(entryKey.getValue(), entryValue.getValue()); | View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3877380#3877380 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3877380 |