methods of a class

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jon Slaughter

    methods of a class

    is it possible to iterate through the methods in a class?

    Thanks,
    Jon


  • Rik

    #2
    Re: methods of a class

    On Wed, 06 Jun 2007 23:31:06 +0200, Jon Slaughter
    <Jon_Slaughter@ Hotmail.comwrot e:
    is it possible to iterate through the methods in a class?


    Or use Reflection:
    PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.


    --
    Rik Wasmus

    Comment

    • Carl

      #3
      Re: methods of a class

      "Jon Slaughter" <Jon_Slaughter@ Hotmail.comwrit es:
      is it possible to iterate through the methods in a class?
      >
      Thanks,
      Jon
      If you want to see the public member methods you can do
      something like this:

      ----8<----
      package test;

      import java.lang.refle ct.Method;

      public class Test {

      public static void main(String[] args)
      throws ClassNotFoundEx ception {
      Class c = Class.forName(" java.lang.refle ct.Method");
      Method methods[] = c.getMethods();
      for (Method m : methods) {
      System.out.prin tln(m);
      }
      }
      }
      ---->8----

      Docs here:
      http://java.sun.com/javase/6/docs/ap...ml#getMethods()

      Hope that helps,
      Carl.

      Comment

      • Carl

        #4
        Re: methods of a class

        "Jon Slaughter" <Jon_Slaughter@ Hotmail.comwrit es:
        is it possible to iterate through the methods in a class?
        >
        Thanks,
        Jon

        Doh!

        That last reply was clearly posted to the wrong group.

        Sorry,
        Carl.

        Comment

        • Jon Slaughter

          #5
          Re: methods of a class


          "Rik" <luiheidsgoeroe @hotmail.comwro te in message
          news:op.ttir9um mqnv3q9@metalli um...
          On Wed, 06 Jun 2007 23:31:06 +0200, Jon Slaughter
          <Jon_Slaughter@ Hotmail.comwrot e:
          >is it possible to iterate through the methods in a class?
          >

          >
          Or use Reflection:
          PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.

          >
          --
          Rik Wasmus
          Thanks,
          Jon


          Comment

          Working...