commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus Härnvi <j...@harnvi.net>
Subject [betwixt] Problem with java.awt.Color
Date Sun, 20 May 2007 15:01:22 GMT
Hi!

I have an issue (de)serializing instances of java.awt.Color. I have a 
working solution:

I Added a java.awt packages in my own source code and added a .betwixt 
file there:

<?xml version='1.0' encoding='UTF-8' ?>
<info primitiveTypes='attribute'>
<element name="color">
   <attribute name='className' value='java.awt.Color'/>
   <hide property="colorSpace"/>
  <addDefaults/>
</element>
</info>

Then I implemented ChainedBeanCreator and got the RGB values from the 
attribute:
mapping.getAttributes().getValue("red"), and return a new Color instance.

It works fine, but when used in Tomcat and in an application built on 
Netbeans Platform the betwixt file is not found. I think it's a 
classloading issue. Tomcat and Netbeans won't let me load things from 
the java.awt package inside my jar file. The result is that the RGB 
values end up as elements instead of attributes, and my 
ChainedBeanCreator fails.

So, I need to rework the ChainedBeanCreator to work with elements, and 
I can't figure it out. Here is the resulting XML (without the betwixt 
file in action):

<color id="1285042238">
  <RGB><![CDATA[-65536]]></RGB>
  <alpha><![CDATA[255]]></alpha>
  <blue><![CDATA[0]]></blue>
  <green><![CDATA[0]]></green>
  <red><![CDATA[255]]></red>
  ....
</color>

Anyone have an example on how to work with elements in a 
ChainedBeanCreator? I guess other people need to deal with 
java.awt.Color properties?

    /Markus



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