I suppose I could generalize this to allow either static or member
method serializers. Why don't you add it as an improvement in Jira?
- Dennis
Hervé Bitteur wrote:
Hi,
Yes, why do we need a STATIC serializer ?
A static method makes sense for a deserializer since we don't have an
instance at hand.
But I don't understand this restriction for a serializer, because in
that case we do have an instance ready.
This gets more frustrating when dealing with enums of Java 5.
Suppose we have an enum called Weekday.
* A natural deserializer is the pre-defined
Weekday.valueOf(String), and it works OK. valueOf is pre-defined
for every enum class.
* A natural serializer would be Weekday.toString(), which is NOT
accepted by the binder since it is not static. Why ???
The workaround is to explicitly define a static method as follows :
private static String serializer (Weekday day) { return day.toString(); }
A bit awkward ...
Who could explain this ?
Bye
/Hervé
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users