Files
example-code-2e/11-pythonic-obj/private/no_respect.py
Luciano Ramalho 70132a37c2 ch11: sample code
2020-06-09 01:16:38 -03:00

18 lines
421 B
Python

"""
In the Jython registry file there is this line:
python.security.respectJavaAccessibility = true
Set this to false and Jython provides access to non-public
fields, methods, and constructors of Java objects.
"""
import Confidential
message = Confidential('top secret text')
for name in dir(message):
attr = getattr(message, name)
if not callable(attr): # non-methods only
print name + '\t=', attr