× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



> From: Barbara Morris
> 
> I think it would be a fairly straightforward enhancement to allow
> variable names for Java calls.  Do you have an example scenario where
> you'd want the class name or method name to be a variable?  (The
> signature (return value and parm types) would have to be fixed.)

Class name more than method name, I think.  It would be a great way to
allow a Factory type of pattern.  In my case, I'm writing a benchmark
program.  With a variable name for the class name, I could add a new
test by simply adding the class to the JAR file and then adding a record
to a database.  The RPG program would read the database and instantiate
the corresponding class.

This sort of extension could be used for everything from HTML formatting
to special pricing.  It would be a nifty way of dynamically extending a
standard Java hierarchy via database values; something that Java doesn't
do very well.  It would certainly be a differentiator for iSeries Java.

I'm a little unclear as to how tightly typed the type O variables are.
If I declare a type O variable as class Widget, must I instantiate an
object of type Widget to stick in there?  Can I use a subclass of
Widget?  Can I use a class that's NOT a subclass, provided the method I
later invoke has the same signature?

I can do this with a factory method.  I'd have to instantiate the
factory, and then pass the class name into the factory as a parameter to
instantiate the actual object (or have a delegate method in the factory
that emulates the desired method, only taking a class name as well).  It
would be a little easier if I could do it in the RPG, is all.

Joe


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.