• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

got private variables :(

 
Ranch Hand
Posts: 290
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all

By using reflection API we can access the private variable except inherited members.

then how can we protect the private member from the reflection API also.

regards
Chiru
 
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Chiranjeevi Kanthraj wrote:Hi all

By using reflection API we can access the private variable except inherited members.

then how can we protect the private member from the reflection API also.

regards
Chiru


HI chiru .. im not having idea regarding this issue....
 
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Chiranjeevi Kanthraj wrote:Hi all

By using reflection API we can access the private variable except inherited members.

then how can we protect the private member from the reflection API also.

regards
Chiru



Change the JVM security settings.
 
Chiranjeevi Kanthraj
Ranch Hand
Posts: 290
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Change the JVM security settings.



any links please.
 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi! Have a look at Sun's Security Guide (the last four bullets of 'General Security') and google for 'Security Manager' and 'security policy file'.
 
Sheriff
Posts: 22787
131
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Chiranjeevi Kanthraj wrote:Hi all

By using reflection API we can access the private variable except inherited members.

then how can we protect the private member from the reflection API also.

regards
Chiru


Use Class.getSuperclass() in combination with Class.getDeclaredFields(), and loop until you've reached the end:
 
Marshal
Posts: 79470
379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
More difficult a question than we expect on "beginners." Moving.
 
reply
    Bookmark Topic Watch Topic
  • New Topic