File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

got private variables :(

 
Chiranjeevi Kanthraj
Ranch Hand
Posts: 290
Hibernate Spring Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
santhosh.R gowda
Ranch Hand
Posts: 296
  • 0
  • Mark post as helpful
  • send pies
  • 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....
 
Duc Vo
Ranch Hand
Posts: 254
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Change the JVM security settings.


any links please.
 
Adam Michalik
Ranch Hand
Posts: 128
  • 0
  • Mark post as helpful
  • send pies
  • 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'.
 
Rob Spoor
Sheriff
Pie
Posts: 20372
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • 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:
 
Campbell Ritchie
Sheriff
Pie
Posts: 47253
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
More difficult a question than we expect on "beginners." Moving.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic