My best approach so far is to create a method with the same name that takes
strings as parameters and then let the method handle the typing.  It's not
perfect, but at least it stays within the object.

I'm still open to better solutions.

-----Original Message-----
From: Jeff Fisher [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 12, 2002 8:51 AM
To: JDJList
Subject: [jdjlist] Determine type from text


Given the following xml file:

<?xml version="1.0"?>
<ServiceRequest>
   <Service>
      com.emerywaterhouse.websvc.FrtCalc
   </Service>
   <Method>
      getFreightCharge
   </Method>
   <Param>
      <Type>
        String
      </Type>
      <Value>
         UPSG
      </Value>
   </Param>
   <Param>
      <Type>
         String
      </Type>
      <Value>
         04104
      </Value>
   </Param>
   <Param>
     <Type>
         int
      </Type>
      <Value>
         100
      </Value>
   </Param>
</ServiceRequest>

Using reflection I can create the class, and call the method.  The only
problem is determining and converting the parameters to the correct type.  I
suppose I can use a brute force method and have a large number of if else
statements, but that doesn't seem viable.  Also, if the parameter is an
object, I'll never be able to code for all possible objects.

I've looked through a number of resources, but nothing I've seen has
examples of determining the types for parameters.

Does anyone have a suggestion here or a resource I can look at.

TIA

Jeff

To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm

To change your JDJList options, please visit: http://www.sys-con.com/java/list.cfm

Reply via email to