Re: "protected" attributes in Component .java files.

From: Janine Sisk (janin..urfly.net)
Date: Mon Jul 02 2007 - 17:44:12 EDT

  • Next message: Mike Schrag: "Re: "protected" attributes in Component .java files."

    On Jul 2, 2007, at 2:35 PM, David Avendasora wrote:

    > The problem I'm running into is that almost all the attributes that
    > were setup in WOBuilder are "protected", and now Eclipse is reporting
    > that the attributes don't exist. If I mark them as "public" then the
    > problem goes away.
    >
    > What is the proper way to handle this?

    I'm feeling an urge to channel Chuck....

    He has taught me, forcefully :), that the right thing to do is to
    leave these protected and write getter and setter methods for them.
    Yes, it's kind of a pain. But he says that this protects you in the
    future; if you end up actually needing to use an accessor method
    then you can just modify the one that's already there instead of
    trying to track down all the places you accessed the variable
    directly. It's also better if you need to subclass in the future, I
    imagine for the same reason.

    It's not quite as much work as it sounds; if your variable is named
    foo, and your getter and setter are foo() and setFoo() respectively,
    WO will find and use them automatically. So you don't have to change
    your bindings.

    janine



    This archive was generated by hypermail 2.0.0 : Mon Jul 02 2007 - 17:44:56 EDT