It's about the bytecode generation that Tapestry does on components.
Since it is designed to work lazily, and piecemeal (one class at a
time) it wants to limit the scope of changes.

Basically, most of those private fields are rewritten into get and set
methods, and every reference to those fields within the individual
class are converted to invoke the get and set methods.

If the methods had any wider scope visibility, then we'd have to go
locate and instrument those other classes as well ... something that,
say AspectJ can do at build time, but something very expensive to do
at runtime while the developer is twiddling their thumbs.

In any case, I will be taking a crack at supporting this in 5.4 ...
allowing fields to be non-public, but not necessarily private.

On Fri, Oct 21, 2011 at 7:48 AM, hese <1024h...@gmail.com> wrote:
>
> I understand encapsulation and the need for it, but isn't it very common for
> base classes to have protected variables which the derived classes can
> access freely without having accessor methods?
>
> Is there any architectural reason in tapestry for disallowing this for
> property and injected variables?  I get this error -
>
> ... contains fields that are not private. You should change these fields to
> private, and add accessor methods if needed.
>
> I have a wizard and there are some common properties and injected stuff ...
> but i want to freely access these variables by having them 'protected'
> instead of writing numerous getters and setters.
>
>
>
>
>
>
>
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/why-does-tapestry-force-variables-to-be-private-tp4924925p4924925.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to