• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reflection API

 
Swapan Golla
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was thinking of writing a complete one set of code for network mode and another for non-network mode, can't we have a single set of classes which use the reflection API to know whether it is remote connection or local connection and thereby call the methods appropriately. I agree that it is becoming complicated, Does anybody has any views on this thought ?
Regards,
Swapan.
 
Judy Xu
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi:
I think you can use one set of classes to do both by taking advantage of Reflection API. Or you can use Higher-order functions like filter to choose which method you are going to use, like Method someMethodYouWant = yourDefinedClass.class.getMethod("yourMethodName", new Class[] {paraTypes});. Just for your reference.
Judy
 
Swapan Golla
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How is this different from what reflection API offers like
Method mymethod = Object.getClass().getDeclaredMethod(methodName, array of arguement objects) and invoke it. Is there anybody who is thinking of using reflection to do their developer assignment. I am in confusion now regarding what is a filter function..
Swapan...
 
If you are using a wood chipper, you are doing it wrong. Even on this tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!