You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Smith, Pamela" <Pa...@sabre.com> on 2004/03/10 22:25:13 UTC

[betwixt] - Handling java.awt.Point, Dimension and KeyStroke

I have a bean with properties whose types are non bean compliant Java classes -- java.awt.Point, java.awt.Dimension and java.awt.KeyStroke.  The xml is written correctly, but after parsing, the resulting instances don't have the right values since Point, Dimension and KeyStroke are not beans.

Has anyone already solved this problem?

Thanks,
Pam

Ex:

<?xml version="1.0" encoding="UTF-8"?>
  <Point>
    <x>10.0</x>
    <y>15.0</y>
  </Point>


BeanReader reader = new BeanReader();
reader.registerBeanClass("Point", java.awt.Point.class);
Point p = (Point)reader.parse...

The resulting point is not [10,15] since there is no setX() and setY() on java.awt.Point.



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


Re: [betwixt,jelly,beanutils] - Handling java.awt.Point, Dimension and KeyStroke

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
On 11 Mar 2004, at 09:33, Paul Libbrecht wrote:

> We had a similar problem with Jelly and I remember we have crafted the 
> notion of "converters" to convert strings to Point, DebugGraphics, 
> Dimension, and Color. None yet for KeyStroke but that could be easily 
> solved, I remember it became hard when we wanted Font...

:)

> I think the issue was that these converters should be living at the 
> level of BeanUtils, having a notion of "converter-context". Robert, 
> didn't you mention that there was something changing in this area on 
> the BeanUtils side after your jaxme efforts ?

now that i know jelly a little better i think that i can see how some 
of the newer beanutils ideas would probably benefit jelly but these 
changes are many about factoring the code better so that it's easier to 
customize (rather than moving more things into beanutils). some of 
these should allow jelly tag libraries to be implemented more elegantly 
and easily than at present. i'll probably have more motivation to work 
on them if they are going to be useful in jelly.

stephen's been quietly been working on a separate convert component. 
the idea is that this component will have a completely new design 
unconstrained by backward compatibility.  hopefully, you should be able 
to plug in an adapter when the appropriate functionality has been 
factored out of beanutils. maybe we should catch up on the progress 
he's been making...

- robert


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


Re: [betwixt,jelly,beanutils] - Handling java.awt.Point, Dimension and KeyStroke

Posted by Paul Libbrecht <pa...@activemath.org>.
We had a similar problem with Jelly and I remember we have crafted the 
notion of "converters" to convert strings to Point, DebugGraphics, 
Dimension, and Color. None yet for KeyStroke but that could be easily 
solved, I remember it became hard when we wanted Font...

I think the issue was that these converters should be living at the 
level of BeanUtils, having a notion of "converter-context". Robert, 
didn't you mention that there was something changing in this area on 
the BeanUtils side after your jaxme efforts ?

thanks

paul

On 10-Mar-04, at 23:12 Uhr, robert burrell donkin wrote:
> betwixt is bean-centric. it's support for other types is pretty basic 
> at the moment (i'm afraid). i don't know of any way to do this in 
> betwixt at the moment.
>
> but this is a pretty common use case so there's a chance that 
> something like this could get implemented sooner rather than later. 
> i'll have a think about the design.
>
> - robert
>
> On 10 Mar 2004, at 21:25, Smith, Pamela wrote:
>
>> I have a bean with properties whose types are non bean compliant Java 
>> classes -- java.awt.Point, java.awt.Dimension and java.awt.KeyStroke. 
>>  The xml is written correctly, but after parsing, the resulting 
>> instances don't have the right values since Point, Dimension and 
>> KeyStroke are not beans.
>>
>> Has anyone already solved this problem?
>>
>> Thanks,
>> Pam
>>
>> Ex:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>>   <Point>
>>     <x>10.0</x>
>>     <y>15.0</y>
>>   </Point>
>>
>>
>> BeanReader reader = new BeanReader();
>> reader.registerBeanClass("Point", java.awt.Point.class);
>> Point p = (Point)reader.parse...
>>
>> The resulting point is not [10,15] since there is no setX() and 
>> setY() on java.awt.Point.
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org


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


Re: [betwixt] - Handling java.awt.Point, Dimension and KeyStroke

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
hi pamela

betwixt is bean-centric. it's support for other types is pretty basic 
at the moment (i'm afraid). i don't know of any way to do this in 
betwixt at the moment.

but this is a pretty common use case so there's a chance that something 
like this could get implemented sooner rather than later. i'll have a 
think about the design.

- robert

On 10 Mar 2004, at 21:25, Smith, Pamela wrote:

> I have a bean with properties whose types are non bean compliant Java 
> classes -- java.awt.Point, java.awt.Dimension and java.awt.KeyStroke.  
> The xml is written correctly, but after parsing, the resulting 
> instances don't have the right values since Point, Dimension and 
> KeyStroke are not beans.
>
> Has anyone already solved this problem?
>
> Thanks,
> Pam
>
> Ex:
>
> <?xml version="1.0" encoding="UTF-8"?>
>   <Point>
>     <x>10.0</x>
>     <y>15.0</y>
>   </Point>
>
>
> BeanReader reader = new BeanReader();
> reader.registerBeanClass("Point", java.awt.Point.class);
> Point p = (Point)reader.parse...
>
> The resulting point is not [10,15] since there is no setX() and setY() 
> on java.awt.Point.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>


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