[jira] Created: (JIBX-224) Ability to unmarshall to an already instantiated object

View: New views
4 Messages — Rating Filter:   Alert me  

[jira] Created: (JIBX-224) Ability to unmarshall to an already instantiated object

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ability to unmarshall to an already instantiated object
-------------------------------------------------------

                 Key: JIBX-224
                 URL: http://jira.codehaus.org/browse/JIBX-224
             Project: JiBX
          Issue Type: Improvement
          Components: core
            Reporter: Jon Little
         Attachments: IUnmarshallingContext.java, UnmarshallingContext.java

Adid the ability to  unmarshall to an already instantiated object.

This is particularly useful for the Struts2 RESTful plug in.

--
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

       

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
jibx-devs mailing list
jibx-devs@...
https://lists.sourceforge.net/lists/listinfo/jibx-devs

[jira] Updated: (JIBX-224) Ability to unmarshall to an already instantiated object

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ http://jira.codehaus.org/browse/JIBX-224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dennis Sosnoski updated JIBX-224:
---------------------------------

    Assignee: Dennis Sosnoski

You can already unmarshal to an existing object by casting it to IUnmarshallable (which interface will be added to the class by the binding compiler if it has a concrete global mapping), then calling the unmarshal() method of that interface. Is there a reason you can't use this approach, and need to have it as part of the context API?

> Ability to unmarshall to an already instantiated object
> -------------------------------------------------------
>
>                 Key: JIBX-224
>                 URL: http://jira.codehaus.org/browse/JIBX-224
>             Project: JiBX
>          Issue Type: Improvement
>          Components: core
>            Reporter: Jon Little
>            Assignee: Dennis Sosnoski
>         Attachments: IUnmarshallingContext.java, UnmarshallingContext.java
>
>
> Adid the ability to  unmarshall to an already instantiated object.
> This is particularly useful for the Struts2 RESTful plug in.

--
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

       

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
jibx-devs mailing list
jibx-devs@...
https://lists.sourceforge.net/lists/listinfo/jibx-devs

[jira] Commented: (JIBX-224) Ability to unmarshall to an already instantiated object

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/JIBX-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=140021#action_140021 ]

Jon Little commented on JIBX-224:
---------------------------------

I can use that approach and have just switched to using it.

I merely did not know that this facility existed.

> Ability to unmarshall to an already instantiated object
> -------------------------------------------------------
>
>                 Key: JIBX-224
>                 URL: http://jira.codehaus.org/browse/JIBX-224
>             Project: JiBX
>          Issue Type: Improvement
>          Components: core
>            Reporter: Jon Little
>            Assignee: Dennis Sosnoski
>         Attachments: IUnmarshallingContext.java, UnmarshallingContext.java
>
>
> Adid the ability to  unmarshall to an already instantiated object.
> This is particularly useful for the Struts2 RESTful plug in.

--
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

       

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
jibx-devs mailing list
jibx-devs@...
https://lists.sourceforge.net/lists/listinfo/jibx-devs

[jira] Commented: (JIBX-224) Ability to unmarshall to an already instantiated object

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/JIBX-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=140028#action_140028 ]

Jon Little commented on JIBX-224:
---------------------------------

Having implemented the pre-scribed way to unmarshall to an already instantiated object I really really do not like having an uncondityional cast in my code:

  /**
   * @see org.apache.struts2.rest.handler.ContentTypeHandler#toObject(java.io.Reader, java.lang.Object)
   */
  public void toObject(Reader in, Object target)
  {
    init();
   
    try
    {
      IUnmarshallingContext umc = bf.createUnmarshallingContext();
      umc.setDocument(in);
      // This un-conditional cast is the current way that JibX unmarshalls to an
      // already instantiated object - YUCK
      ((IUnmarshallable)target).unmarshal(umc);
    }
    catch (JiBXException e)
    {
      log.error("Problem while unmarshalling XML to an object");
      log.error(e.getMessage());
      log.error(e.getStackTrace());
    }
  }

Therefore I would really like to see my new methods added to the context API.

BTW, I did have an instanceof test but that failed for reasons that I could only deduce to how the byte code is altered

> Ability to unmarshall to an already instantiated object
> -------------------------------------------------------
>
>                 Key: JIBX-224
>                 URL: http://jira.codehaus.org/browse/JIBX-224
>             Project: JiBX
>          Issue Type: Improvement
>          Components: core
>            Reporter: Jon Little
>            Assignee: Dennis Sosnoski
>         Attachments: IUnmarshallingContext.java, UnmarshallingContext.java
>
>
> Adid the ability to  unmarshall to an already instantiated object.
> This is particularly useful for the Struts2 RESTful plug in.

--
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

       

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
jibx-devs mailing list
jibx-devs@...
https://lists.sourceforge.net/lists/listinfo/jibx-devs
LightInTheBox - Buy quality products at wholesale price