javaee / jaxb2-commons

JAXB Implementation project has been contributed to Eclipse Foundation. This repository is for legacy review only. Please refer to the Eclipse EE4J Metro project for the very latest
https://eclipse-ee4j.github.io/jaxb-ri/
Other
17 stars 15 forks source link

Provide a means to use copyBuilder to do best effort of copying #15

Closed glassfishrobot closed 15 years ago

glassfishrobot commented 15 years ago

Related to issue: https://jaxb2-commons.dev.java.net/issues/show_bug.cgi?id=10

In my project the schemas often have xs:any that make generated classes throw java.lang.UnsupportedOperationException. In many cases it would be useful to have an option to copy the object on a best effort basis to copy all supported sub-objects. This is to request some operation like the following in CopyBuilder:

public Object copyTo(Object target, boolean bestEffort);

Environment

Operating System: All Platform: All

Affected Versions

[0.3]

glassfishrobot commented 15 years ago

Reported by najmi

glassfishrobot commented 15 years ago

lexi said: Hi Farrukh,

would you explain what you mean by the "best effort"? Like, "try copying that, if copying failed, it's no big deal, return null an go ahead"? Right now you can achieve this by providing your own copy builder when copying. I don't think there should be any boolean flag to indicate best-effort, this is clearly a task of copy builder to implement the copying strategy.

I can imaging something like BestEffortCopyBuilderWrapper which wraps another copy builder; if core copy builder throws exception when copying then BestEffortCopyBuilderWrapper returns some default value instead. Would this fit your needs?

glassfishrobot commented 15 years ago

najmi said: I agree with your assessment Lexi and will close this issue. Thanks.

glassfishrobot commented 15 years ago

lexi said: Closed.

glassfishrobot commented 15 years ago

Was assigned to lexi

glassfishrobot commented 7 years ago

This issue was imported from java.net JIRA JAXB2_COMMONS-15

glassfishrobot commented 15 years ago

Marked as incomplete on Sunday, November 23rd 2008, 3:34:31 pm