J
Jeroen Budts
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
Is it somehow possible to access a private method of one class from
inside another class?
by example: I have a class MyEntity with a private method setFoo(int n)
and i want to call it from inside the class MyBar. I know this is
against the rules of encapsulation but somehow it is possible i think,
since Hibernate seems to do this. For Hibernate it doesn't mather if the
accessors of a mapped attribute are private, protected or public, it
will set them anyway..
Do I need something like ASM for this or can it be done with reflection?
thx!
Jeroen
- --
<TeRanEX/>
--- e-mail: (e-mail address removed) - jid: (e-mail address removed)
--- blog: http://budts.be/weblog/ - cv: http://budts.be/jeroen/
--- projects: http://lightyear.be - pgp: 0x8B7B774A
_____________________________________
NO SoftwarePatents in Europe!
See an example: http://webshop.ffii.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCgNFmH04wF4t7d0oRArVWAKCCVpPD9fxxSm0DiahNAFL4qNieHwCffEe9
t0cSRRwCYmVZmaThBsIyIFk=
=RhfE
-----END PGP SIGNATURE-----
Hash: SHA1
Hi,
Is it somehow possible to access a private method of one class from
inside another class?
by example: I have a class MyEntity with a private method setFoo(int n)
and i want to call it from inside the class MyBar. I know this is
against the rules of encapsulation but somehow it is possible i think,
since Hibernate seems to do this. For Hibernate it doesn't mather if the
accessors of a mapped attribute are private, protected or public, it
will set them anyway..
Do I need something like ASM for this or can it be done with reflection?
thx!
Jeroen
- --
<TeRanEX/>
--- e-mail: (e-mail address removed) - jid: (e-mail address removed)
--- blog: http://budts.be/weblog/ - cv: http://budts.be/jeroen/
--- projects: http://lightyear.be - pgp: 0x8B7B774A
_____________________________________
NO SoftwarePatents in Europe!
See an example: http://webshop.ffii.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCgNFmH04wF4t7d0oRArVWAKCCVpPD9fxxSm0DiahNAFL4qNieHwCffEe9
t0cSRRwCYmVZmaThBsIyIFk=
=RhfE
-----END PGP SIGNATURE-----