Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] ITD public fields break encapsulation?

This may be a FAQ, but when you are doing compile-time weaving and
introduce a field into classes matching your type expression, that
field is public with a mildly obfuscated name, which I assert breaks
encapsulation.

If I introduce an implementation of an interface into classes, I would
prefer that the private fields and methods supporting the public
methods of the interface be non-public in the introduced class.
Otherwise, when the class is used, a client can directly set the
introduced field(s), which should be encapsulated from the client;
they shouldn't even see them.

Is there a way to introduce interface implementations that don't
change the public interface of the introduced class other than simply
adding the "implements" declaration and the implemented methods?

TIA,
Matthew


Back to the top