Results 1 to 3 of 3
  1. #1
    rsegecin is offline Member
    Join Date
    Oct 2010
    Posts
    2
    Rep Power
    0

    Default Count the numbers of parameters programmatically that a method has in JAVA?

    Hello I'm new here in this forum and I'm still learning Java, but I don't think that this question fits in any other category, I'm sorry if I'm wrong. I would like to count the numbers of parameters programmatically that a method has.
    It's for my home work that consists in transmitting data over UDP and I'm creating the protocol which will make it happen. I'm was thinking in how to transmit more than one parameter in a message, so I came up with the idea of
    send each parameter in a different DatagramPacket rebuilding the identified message, but for reliability of the system and efficiency I would like that the parameters passed through the message checks with the numbers of parameters that the server or the client will need to execute otherwise throw a error.
    I believe it's done with reflection.
    Thank you very much.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,433
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by rsegecin View Post
    I believe it's done with reflection.
    Yup, you're right; read all about it in the API documentation (pay close attention to the Class and Method classes).

    kind regards,

    Jos

  3. #3
    rsegecin is offline Member
    Join Date
    Oct 2010
    Posts
    2
    Rep Power
    0

    Default

    Thanks mate I've just checked out and found the answer =D.

Similar Threads

  1. Replies: 8
    Last Post: 06-07-2009, 02:29 AM
  2. Need to dynamicaly get all parameters in a method call.
    By DavidJohns in forum Advanced Java
    Replies: 2
    Last Post: 05-21-2008, 07:15 AM
  3. Replies: 9
    Last Post: 12-18-2007, 09:02 AM
  4. Replies: 0
    Last Post: 11-10-2007, 04:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •