| | |
Reflection in Python
![]() |
•
•
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: 3213 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for Java
actionlistener add android applet application arguments array arraylist arrays binary c++ chat class classes client code component constructor convert data database db design desktop detection eclipse error event exception file forloop fractal givemetehcodez graphics gridlayout gui helpwithhomework homeworkassignment html ide image inheritance input integer interface j2me java javafx jframe jpanel jtextarea jtextfield key lazy linked linked-list list loop looping method methods mobile netbeans newbie node number object objects oracle output page pattern pixel problem programming read recursion remove return robot scanner search server service set size sms sql string swing system text text-file threads timer transfer translate tree user web







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