aspose file tools*
The moose likes Java in General and the fly likes Externalizing method calls Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Externalizing method calls" Watch "Externalizing method calls" New topic
Author

Externalizing method calls

M Givney
Greenhorn

Joined: Sep 24, 2003
Posts: 25
Hiya folks,
Wonder if anyone can help me with my latest endeavor.
I have a set of Java entities (POJOs) with getter and setter methods that will store data. These entities are going to be processed by stored procedures, but based on the application that consumes them, they need to be processed differently. So rather than writing a crazy "if" statement or multiple objects that do basically the same thing, just in different formats, and since all of the actual meat happens in stored procedures in the database...I want to create an xml document that stores some information about the entity, and appropriate stored procs that process them. I need to bind the strings stored within the xml to Java types but I am a little confused on how to get this done.
In order to populate the CallableStatement that will execute the stored procedure, I need some values within the entity objects (i.e. I need to be able to call the getter methods).
So for example:
I have an entity named MyObject that has a method named getSomething() which returns a String. I can create MyObject by using:
Class.forName("myClass").newInstance();
My problem is that I want to get the value that getSomething() returns but I am not sure how to do it. I have a string in the xml that corresponds to the getter method call in MyObject, but I don't know how to convert that string into an actual invocation of the getSomething method and have it return a value.
I am almost positive this can be done, but I am unsure of how to do it. Can anyone give me an example or point me in the direction of how to do it?
Thanks in advance!
Matt
[ October 23, 2003: Message edited by: M Givney ]
[ October 23, 2003: Message edited by: M Givney ]
[ October 23, 2003: Message edited by: M Givney ]
Maverick Lasa
Greenhorn

Joined: Oct 18, 2003
Posts: 23
Hello Givney.
Try this:

Mavedrive;
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Externalizing method calls