Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Subclassing and check methods

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: "Bradley S. Huffman" <hip AT cs.okstate.edu>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Subclassing and check methods
  • Date: Thu, 11 Mar 2004 23:34:42 -0600

"Bradley S. Huffman" writes:

> Elliotte Rusty Harold writes:
>
> > The fields can still be private. However the accessor/mutator methods
> > don't have to be final. They can call the superclass methods to make
> > their changes. As long as the fields remain private and the accessor
> > methods are final, this would not enable anyone to violate the
> > fundamental class invariant of well-formedness. Subclasses could
> > override insertChild, setLocalName, etc. without being able to bypass
> > the well-formedness checks.
>
> Unless they do
>
> private String myLocalName;
>
> public void setLocalName(String localName) {
> myLocalName = localName;
> }
>
> public String getLocalName() {
> return myLocalName;
> }

Hmm, what if only all getter where final? A subclasser could then pull a trick
like the one above, but not do much with it.

Brad




Archive powered by MHonArc 2.6.24.

Top of Page