cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Mittendorf <>
Subject Re: Why is method encodeProperty(String, Object, boolean) of XMLEncoder private?
Date Tue, 26 Sep 2006 15:16:12 GMT

Am 26.09.2006 um 15:11 schrieb Kevin Menard:

> It looks like the subject and body really ask two different  
> questions.  Addressing the subject, the method is package-protected  
> because in general you should be able to use the public  
> encodeProperty().

I actually changed my mind while writing this email ;-)

But your hint were very helpful and I think I can get the result that  
I wish without the need for changes of cayenne.

I don't need to be compatible with WO, I just want to store an object  
tree as an xml file.



> With regards to storing null values, I believe it's implemented as  
> is because null indicates a lack of value.  Allowing null was  
> problematic for the serialization process and it was decided that  
> it was better handled in the user's constructor, which should  
> initialize all non-used values to an appropriate null state.  This  
> may have been the WO way of doing things as well (which we were  
> trying to maintain compatibility with).
> What is it that you're trying to accomplish?  If it's compelling  
> enough, we can open up a JIRA issue and reinvestigate the matter.
> -- 
> Kevin
> Christian Mittendorf wrote:
>> Hello!
>> I would like to serialize properties that are NULL into the xml.
>> I therefore submit a String "" to the serializer, but in those cases
>> the type will be set to String instead of Date or whatever type the
>> property actually is.
>> It would be helpful if I could configure the encodeProperty method
>> in a way that it would do something else than simply return if a
>> value is null:
>> void encodeProperty(String xmlTag, Object value, boolean useType)
>> ...
>> if (value == null) {
>>     return;
>> }
>> Christian

View raw message