Re: Why is method encodeProperty(String, Object, boolean) of XMLEncoder private?

From: Kevin Menard (kmenar..ervprise.com)
Date: Tue Sep 26 2006 - 09:11:48 EDT

  • Next message: Francesco Fuzio: "Re: Caching query results"

    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



    This archive was generated by hypermail 2.0.0 : Tue Sep 26 2006 - 09:11:57 EDT