| | |
Weird Question
Thread Solved |
•
•
Join Date: Sep 2008
Posts: 1,580
Reputation:
Solved Threads: 199
•
•
•
•
> Can anyone provide a reasonable example of a situation that needs reflection and a short explanation of why?
We use it on our current project for dynamic configuration of our UI. All panel components share an interface and with a simple XML file we can reconfigure the frames and panels with no change to the compiled jar file. We also use it for our reporting engine to load column classes that can be plugged in to our table-based reports. These are simple usages of loading classes that share a common interface by supplying their class name and other properties in simple xml files.
Last edited by BestJewSinceJC; Nov 10th, 2008 at 11:30 pm.
•
•
Join Date: Nov 2008
Posts: 19
Reputation:
Solved Threads: 6
•
•
•
•
Can you elaborate somewhat on the first example? The second example seems to make sense - you have a table and its layout set ahead of time, and based on what Strings are input, that table looks up the classnames (presumably each String represents a classname?) then fills the table with each of those classes, treating a class as a 'column'?
Reflection is used for calling methods, not class creation. So my DAO (data access object) class would have methods like: getUserId, getCurrentDTTM, etc. And I could call these methods using string literals ("getUserId", "getCurrentDTTM") from the code. Normally you'd use an interface for that kind of work, but since the DAO objects are auto generated, we used reflection
•
•
•
•
Do you mean that depending on what the contents are of the XML file, different panels would appear which are created from classes that have their own content... but that the type and size of the panel are always the same? Because I don't see how you could use different sized panels each time, that would mess up the layout.
It seems as though you missed my entire post. The first two paragraphs of my previous post mention the most widely used implementations of the reflection API. Another use of the reflection API is to implement the Webservice client for SOAP type web services wherein the XML response from the server is converted to an object tree using the schema definitions.
I don't accept change; I don't deserve to live.
•
•
•
•
What I was saying is that I don't understand most of that terminology, so the point alone has no impact. I hope I wasn't rude - I wasn't trying to be.
If there is a term you don't understand, you should definitely study it. I find it much easier to learn programming concepts after educating myself with terminology.
Not only that, but by understanding more terminology, you can come up with more meaningful definitions for words in code that you are planning to share with others that may work with you or will be the receiver of an implementation you designed when you hand off the code.
Wikipedia, Google and Dictionary are your ultimate programming friends, to say the least! O_O
•
•
Join Date: Sep 2008
Posts: 1,580
Reputation:
Solved Threads: 199
Point taken, but my point was that a combination of unknown phrases adds a lot of ambiguity which makes it difficult to simply do a google search, combine definitions, then come to an understanding. It makes a lot more sense to explain things with some sort of clarity to begin with. And thats not a slight at s.o.s - he has definitely helped me in the past, and is overall a very helpful guy on this site. I'm just saying that its not out of laziness that I don't look those terms up -- its for the same reason that I wouldn't read a passage out of a French 300 textbook if I only knew basic sentences. It would take hours, maybe months, of work just to understand that passage. But maybe I shouldn't be taking the class in the first place. . or asking questions about reflection and expecting fairly simple answers. Lol. And yes, this analogy sucks. It could be applied in 100000 different ways.
Last edited by BestJewSinceJC; Nov 12th, 2008 at 12:56 am.
•
•
•
•
What I was saying is that I don't understand most of that terminology, so the point alone has no impact. I hope I wasn't rude - I wasn't trying to be.
Last edited by ~s.o.s~; Nov 14th, 2008 at 10:49 am.
I don't accept change; I don't deserve to live.
![]() |
Similar Threads
- driver_irql error question (Windows NT / 2000 / XP)
- Straight C (C++)
- HAELP! Fixed vundo and now have no desktop. (Viruses, Spyware and other Nasties)
- Access Control Exception vs. Applet Viewer (Java)
- Quick directory question (C#)
- system restarts by itself...and more weird things (Windows NT / 2000 / XP)
- Weird, weird problems with fstream (C++)
- IE "can't find server" after loading home page (Viruses, Spyware and other Nasties)
- Uber-N00B question (C++)
- What is BRIDGE.DLL (Viruses, Spyware and other Nasties)
Other Threads in the Java Forum
- Previous Thread: Printing output of an array
- Next Thread: How would you go about coding this?
| Thread Tools | Search this Thread |
3d 6 @param affinetransform android api applet application arc array arrays automation binary bluetooth bold byte c++ chat class client code color compare component coordinates database detection doctype eclipse educational error file fractal froglogic game givemetehcodez graphics gui guitesting helpwithhomework html ide ideas image ingres input integer internet intersect j2me java java.xls javaexcel javaprojects jni jpanel jtextarea julia keytool keyword linux list loop map method methods mobile netbeans newbie nextline object pong print problem producer program programming project projectideas read recursion recursive replaysolutions rim scanner sell server set size sms sort sql string swing terminal threads tree web websites windows






