Re: XStream versus XMLEncoder



On 5 Dec, 14:38, Lew <l...@xxxxxxxxxxxxx> wrote:
The problem with having setters, required for a class with a no-arg
constructor when you want to set values of private members, is that you cannot
make the members final. The advantage of constructors with arguments is that
they let you make the members final.

The complaint about having to use setters is that it prevents the use of final
members.

Thanks for that little snippet, this is just the sort of detail I was
after. I am still new to java so I have not used final much, neither
have I seen it used very much. But I see now that for these classes it
is appropriate and it can't be done when using XMLEncoder. Oh, well.
.



Relevant Pages

  • Re: Protected static members, abstract classes, object composition vs. subclassing
    ... unpublished and unknown ECMA 262 4th edition, JScript.net and JavaScript ... combination of a constructor function and its prototype define a process ... Rendering something 'private' is a matter of making it ... 'Private instance members' may be created by having the constructor (or ...
    (comp.lang.javascript)
  • Re: Creating a C++ like message loop in .NET threaded classes.
    ... API functions I wrote a base class that starts a thread in its constructor ... >> writing a singleton class that, at run time, will have its members invoked ...
    (microsoft.public.dotnet.framework)
  • Re: Is CppUnit un-C++
    ... > members instead of pointers. ... class type members as opposed to using pointers to class types as members. ... The issue of header files is really irrelevant in this case. ... should be a constructor and tearDownshould be a destructor. ...
    (comp.lang.cpp)
  • Re: no default constructor -- bad form?
    ... > default constructor? ... I wouldn't base any aspect of my design on "hearing that such-and-such is ... instance it allows you to put members of your class into a container. ... to put them in standard containers no matter what they point to. ...
    (comp.lang.cpp)
  • Re: Exception unwinding base destructor called - why?
    ... > as a kind of compiler independent, ... > unwinding mechanism is calling the destructor for the base class. ... Before the body of the Derived constructor can be invoked, ... as well as all members of Dervied too...). ...
    (comp.lang.cpp)