• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Externalizing method calls

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Givney.
Try this:

Mavedrive;
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic