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.