[ http://jira.codehaus.org/browse/JIBX-95?page=all ] Dennis Sosnoski closed JIBX-95: -------------------------------
> Binding compiler should check for class assignability instead of exact type. > ---------------------------------------------------------------------------- > > Key: JIBX-95 > URL: http://jira.codehaus.org/browse/JIBX-95 > Project: JiBX > Type: Bug > Components: core > Versions: 1.0-RC2 > Environment: jdk 1.5 > Reporter: Maros Ivanco > Assignee: Dennis Sosnoski > > > Binding compiler should check for class assignability instead of exact type > name matching between structure type and mapping class. In the mapping: > <structure field="..." type="ParentType"/> > <mapping name="child1" type="Child1" ...>...</mapping> > <mapping name="child2" type="Child2" ...>...</mapping> > . > . > . > the compiler generates error. I workaround this by using custom un/marshaller > for structure: > public class ConfigHandler implements IMarshaller, IUnmarshaller{ > protected String uri="http://www.datalan.sk/search/robot-config/1.1"; > public boolean isExtension(int index) { > return false; > } > public void marshal(Object obj, IMarshallingContext ictx) throws > JiBXException { > if(!(ictx instanceof MarshallingContext)) throw new > JiBXException("Invalid object type for marshaller"); > ((IMarshallable)obj).marshal(ictx); > } > public boolean isPresent(IUnmarshallingContext ctx) throws > JiBXException { > return ctx.isAt(uri, "processing-option")||ctx.isAt(uri, > "processing-chain")||ctx.isAt(uri, "processor"); > } > public Object unmarshal(Object obj, IUnmarshallingContext ctx) throws > JiBXException { > return ctx.unmarshalElement(); > } > } // end of type > Even though the un/marshaller is that trivial, (or perhaps because of it) the > behaviour should be implemented directly by JiBX. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira ------------------------------------------------------- All the advantages of Linux Managed Hosting--Without the Cost and Risk! Fully trained technicians. The highest number of Red Hat certifications in the hosting industry. Fanatical Support. Click to learn more http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642 _______________________________________________ jibx-devs mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jibx-devs
