cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Menard <kmen...@servprise.com>
Subject Re: Why is method encodeProperty(String, Object, boolean) of XMLEncoder private?
Date Tue, 26 Sep 2006 13:11:48 GMT
Hi Christian,

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().

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


Mime
View raw message