Looping over and dumping a Java object

An app I work on has a constants object, written in Java. I have two
problems with it in Lucee:

  1. In ACF, I can loop over its members with <cfloop
    collection="#Request.Constants#"…>, but in Lucee (and Railo) I get the
    error "Can’t cast Object type [object I’m talking about] to a value of type
    [collection].

  2. writeDump() of that object shows simple values (also including a
    “pattern” attribute I don’t see in ACF), but some keys are struct-like, and
    they show only as “com…Constants$jobdef_constants@31f033f5” and the like.

I’m not a Java guy, but here’s a quick shot I’ve come up with to loop over
the object manually:

flds = Request.Constants.getClass().getDeclaredFields();

writeOutput("

");
for (i = 1; i <= arrayLen(flds); i++)
{
writeOutput("");
}
writeOutput("
#flds[i].getName()# ");
value = flds[i].get(flds[i]);
if (isSimpleValue(value))
writeOutput(htmlEditFormat(value));
else
writeDump(value);
writeOutput("
");

It works, but it’s not ideal that the syntax
doesn’t work for both platforms, and the writeDump() behavior gets in the
way here too.

Would you consider this a Lucee bug? If so, how hard is it to fix?

Coming at it from the other end, how could the Java object be modified to
support in Lucee? How could it be modified so
fields that are structs would dump correctly? Keep in mind that I’m not
much of a Java guy, so an answer to that would need to be clear and simple.

Thanks,
Dave