JiBX
  1. JiBX
  2. JIBX-95

Binding compiler should check for class assignability instead of exact type.

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.0-RC2
    • Fix Version/s: None
    • Component/s: core
    • Labels:
      None
    • Environment:
      jdk 1.5
    • Number of attachments :
      0

      Description

      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.

        Activity

        Hide
        Dennis Sosnoski added a comment -

        Please provide a complete sample for your problem report, including both the relevant portions of the binding definition and the corresponding Java code. Also give the error description provided by the binding compiler.

        Show
        Dennis Sosnoski added a comment - Please provide a complete sample for your problem report, including both the relevant portions of the binding definition and the corresponding Java code. Also give the error description provided by the binding compiler.

          People

          • Assignee:
            Dennis Sosnoski
            Reporter:
            Maros Ivanco
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: