| | |
Reflection in Python
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jun 2005
Posts: 23
Reputation:
Solved Threads: 1
Hi, I was wondering if anone here could help me out a bit with my Reflection problem. My problem is that when I try to find the methods
inside a class, not only do I get its methods, but all of its inherited methods or something like that. So if I ran the below code (Example being a made up class with a couple of methods):
I'd get the first two output as:
public int Example.add(int,int)
public void Example.output()
then the rest would be:
public native int java.lang.Object.hashCode()
public final native java.lang.Class java.lang.Object.getClass()
public final void java.lang.Object.wait() throws java.lang.InterruptedException
public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException
public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException
public boolean java.lang.Object.equals(java.lang.Object)
public final native void java.lang.Object.notify()
public final native void java.lang.Object.notifyAll()
public java.lang.String java.lang.Object.toString()
Which I don't really want to be getting. Is there anyway I could make it so that getmethods() just gets the primary methods? Also, just a sidenote, what's a Field?
inside a class, not only do I get its methods, but all of its inherited methods or something like that. So if I ran the below code (Example being a made up class with a couple of methods):
Java Syntax (Toggle Plain Text)
Class getclass = Class.forName(Example); Object a[] = getclass.getMethods(); for (int i = 0; i < a.length; i++) { System.out.println (a[i]); }
I'd get the first two output as:
public int Example.add(int,int)
public void Example.output()
then the rest would be:
public native int java.lang.Object.hashCode()
public final native java.lang.Class java.lang.Object.getClass()
public final void java.lang.Object.wait() throws java.lang.InterruptedException
public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException
public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException
public boolean java.lang.Object.equals(java.lang.Object)
public final native void java.lang.Object.notify()
public final native void java.lang.Object.notifyAll()
public java.lang.String java.lang.Object.toString()
Which I don't really want to be getting. Is there anyway I could make it so that getmethods() just gets the primary methods? Also, just a sidenote, what's a Field?
![]() |
Similar Threads
- What are the .apy files in Python (Python)
- Python! Thoughts? (Python)
- what is python (Python)
Other Threads in the Java Forum
- Previous Thread: A newbie needs help in Java ......
- Next Thread: Help with Arrays!!!
Views: 3019 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for Java
-xlint android animated api apple applet application arguments array arrays automation binary blackberry block bluetooth chat class classes client code component database detection developmenthelp draw eclipse encode error event exception file fractal game givemetehcodez graphics gui helpwithhomework html ide image input integer iphone j2me j2seprojects java javac javaprojects jmf jni jpanel julia lego linux list loop loops mac map method methods mobile netbeans newbie number object online oracle os page print problem program programming project recursion scanner screen server set singleton size sms socket sort sql string swing template test textfields threads time title transfer tree tutorial-sample update windows working







(yes, I know I keep hammering away at people using them, they're that good) :mrgreen: