How Java Generics Affect PeopleCode

Опубликовано: 17 Май 2026
на канале: JSMpros
599
25

Does the Java "Object" return type force us into #PeopleCode/Java reflection misery? Can you "cast" Java Objects in PeopleCode? #PeopleSoft has fantastic built-in support for Java. Sometimes, figuring out how to translate between the two languages can be challenging. In this episode, we use CreateJavaObject and GetJavaClass to extend the PeopleCode API with Java and discuss how modern Java Generics affect our PeopleCode.

Sample PeopleCode:

Local JavaObject &map = CreateJavaObject("java.util.HashMap");

&map.put("Key 1", CreateJavaObject("java.lang.String", "This is a string"));
Local JavaObject &result = &map.get("Key 1");

/*
Local JavaObject &stringClass = GetJavaClass("java.lang.Class").forName("java.lang.String");
Local JavaObject &newString = &stringClass.cast(&result);
*/

Local JavaObject &newString = &result.getClass().cast(&result);

MessageBox(0, "", 0, 0, "%1", &newString.charAt(2));
MessageBox(0, "", 0, 0, "%1", &result.toString());


Jim Marion is an #OracleAce ♠, author of several PeopleTools books, blogger, public speaker, and PeopleTools instructor. Connect with Jim on LinkedIn at   / jimjmarion  .