commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mornak <dmorna...@gmail.com>
Subject Re: [betwixt] className for String, Integer?
Date Tue, 02 May 2006 13:57:29 GMT
Michael, I think you need to review your mappings. When I had this
kind of problems I made a workaround throught the mappings, without
creating any custom beanCreatorChain (althought it may be work)

If you send your beans and a XML of how they should be outputed I (or
anybody else) may help to resolve your particular problem

(Excuse me awful english, I am from Argentina)

Good luck!



On 5/1/06, robert burrell donkin <robertburrelldonkin@blueyonder.co.uk> wrote:
> On Mon, 2006-05-01 at 15:10 -0500, Michael Gardner wrote:
> > Robert, thanks for the quick response. I submitted a bug to Bugzilla (
> > http://issues.apache.org/bugzilla/show_bug.cgi?id=39460), though without a
> > unit test yet since I'm having trouble getting the Betwixt test harness
> > working.
>
> if you continue to have problems, check out the source from subversion
> and take a look at the test cases in there. betwixt is mavenised
> (http://maven.apache.org) so building is easy. if you use eclipse, maven
> will generate a basic project outline.
>
> > Anyway, my basic use case involves properties that have setters with formal
> > parameter type 'Object': if I try to write such a bean that happens to have
> > a String as the value of such a property, BeanWriter will not write the
> > className property even though I've un-suppressed the className property in
> > general. Then when a BeanReader tries to reconstruct the object, it creates
> > a plain Object instead of a String (this also happens with Integer, etc.).
>
> ok
>
> > I can create wrappers for those types to work around the problem, but it
> > really messes up my code -- especially since this issue affects more than
> > one of my bean types. I thought of modifying Betwixt to no longer treat
> > Strings, etc. as simple types, but would BeanWriter still know how to write
> > them to XML in that case?
>
> recognition of simple types is pluggable. you'd need to create custom
> mappings for Integer and String but that should be ok.
>
> read in again is actually more difficult due to the fact that Integer
> and String are not really beans. i don't have the time to supply any
> code samples right now but i'll try to set you on the right path...
>
> if you have flexibility over the xml format then the quickest and
> easiest way to make things work would be to output the value of the
> string or integer as an attribute. then use a new custom
> BeanCreationChain which knows how to create a string or integer with the
> correct value when called upon to create the object from the complex
> type.
>
> otherwise, you need to looking into creating a custom MappingAction
> which is more difficult.
>
> - robert
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>


--

To Iterate is Human, to Recurse, Divine
 - James O. Coplien, Bell Labs

-------------------------------------
<EPI/> - Deploying ideas
-------------------------------------
Ing. Diego H. Mornacco
Desarrollador
Epidata Consulting
MaipĂș 521 1er piso Of. A
Ofi: 5031 0060 / 61
Cel: 15-5884-0040
www.epidataconsulting.com

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message