updated Java/Jython private field examples

This commit is contained in:
Luciano Ramalho
2014-10-19 15:41:11 -02:00
parent 1d48cdbde5
commit 9da839023e
8 changed files with 26 additions and 18 deletions

View File

@@ -1,12 +1,17 @@
# In the Jython registry:
# python.security.respectJavaAccessibility = false
# Setting this to false will allow Jython to provide access to
# non-public fields, methods, and constructors of Java objects.
"""
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("text you shoudn't see")
message = Confidential('top secret text')
for name in dir(message):
attr = getattr(message, name)
if not callable(attr): # ignore methods
print name, '=', attr
if not callable(attr): # non-methods only
print name + '\t=', attr