Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

On java.lang.Class.getMethods()
Hi all,

What is the reason that getMethods() method (in java.lang.Class)
return only
public methods? After all, couldn't it return all methods, and then,
upon
invocation, throw a SecurityException (or IllegalAccessException)?
What
is the rationale for this?

-----

P.S. After reading http://www.yoda.arachsys.com/java/newsgroups.html,
http://mindprod.com/jgloss/newsgroups.html and
http://www.faqs.org/faqs/computer-l.../help/minifaq/, I do feel
this cross-post is justified. If there's a more authoritative source,
please point them out to me. Advocacy was chosen because this is a
point
of Sun's choice, and security -- because this is related to access of
methods.

Report this thread to moderator Post Follow-up to this message
Old Post
Grisha
10-11-04 08:57 AM


Re: On java.lang.Class.getMethods()

> What is the reason that getMethods() method (in java.lang.Class)
> return only
> public methods? After all, couldn't it return all methods, and then,
> upon
> invocation, throw a SecurityException (or IllegalAccessException)?
> What
> is the rationale for this?

Seen getDeclaredMethods()?

There are two functions because:
- getMethods()  exhibits all methods that "object" of class implements, (inc
luding inherited),
- getDeclaredMethods() exhibits only methods declared in "class" (including 
private, not including
inherited)

so getDeclaredMethods() is more powerful... but in most cases less convenien
t than simple getMethods().

--
jarekr


Report this thread to moderator Post Follow-up to this message
Old Post
jarekr
10-11-04 08:57 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Java Security archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:45 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.