× 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.



On 2017-02-08 5:13 PM, Don Brown wrote:

What from an ILE RPG perspective is the difference between the following
variable's ?

D stringJ S O Class(*JAVA : 'java.lang.String')
D objectJ S O Class(*JAVA : 'java.lang.Object')


From RPG's point of view, there is no difference. They are both Java objects. RPG doesn't care about the class of Object _variables_. The only time it is important for RPG to have the correct class is in prototypes.

From Java's point of view, every class in Java is a subclass of the Object class, so a String is also an Object, but an Object isn't necessarily a String.

I have a requirement to pass a java.lang.Object to a procedure.

Sometimes when a method is defined to take an Object, it can actually only handle some specific classes. I suspect that is the case here for your getMap method.


To create a java string I use the makeString procedure.

I can't seem to find a makeObject procedure.

I don't think you want to create a base Object. The Java Map is a map of objects, but usually (always?) of a specific class. You need to create an object of whatever class your specific Map is using.


This is the procedure I want to use ...

D getMap PR O CLASS(*JAVA : 'java.lang.Object' )
D EXTPROC(*JAVA : 'java.util.Map' :
D 'get' )
D arg0 O CLASS(*JAVA : 'java.lang.Object' )

You can pass a String object (or an object of any class) to this method.

The parameter I need to pass is the name of a custom field that is
returned in the transaction object so I am doing the following ...

customJ = makestring('test_custom_key_1');
stringJ = getMap( JavaMap : customJ );

When the program executes the getMap java blows up and generates a core
dump.

Probably a silly question, but does your JavaMap variable have a non-null value?


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.