Is there any way to automatically generate a static unmarshal method that
takes a 'org.w3c.dom.Node' a parameter?
The Unmarshaller class has such a method so it would be nice if the
generated classes supported this.

I have personally extendend the
org.exolab.castor.builder.SourceFactory.createUnmarshalMethods(JClass
parent, SGStateInfo sgState) method with the code given below, but it would
be nice if I didn't have to do this every time a new release is released.

      //-- create extra unmarshal method
      JClass node = new JClass("org.w3c.dom.Node");

      JMethod extrajMethod = new JMethod(SGTypes.Object ,methodName);
      extrajMethod.getModifiers().setStatic(true);
      extrajMethod.addException(SGTypes.MarshalException);
      extrajMethod.addException(SGTypes.ValidationException);
      extrajMethod.addParameter(new JParameter(node, "node"));
      parent.addMethod(extrajMethod);

      JSourceCode extrajsc = extrajMethod.getSourceCode();
      extrajsc.add("return (");
      extrajsc.append(parent.getName());
      extrajsc.append(") Unmarshaller.unmarshal(");
      extrajsc.append(parent.getName());
      extrajsc.append(".class, node);");


/Christian

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to