Hi
I'm trying to use Inline-Java 0.50, and I am having a problem.
I have a class instantiated, the class has a method that returns an Object.
In Java, I'd have to cast the Object to a String:
String id = (String) bo.getValue("id_number");
In Perl, I would do something such as this:
my $id = $bo->getValue("id_number");
However, this always leaves $id empty.
So, I've tried the 'cast' function.
If I try (i.e. cast the object):
my $id = cast('java.lang.String', $bo)->getValue("id_number");
I get the error:
Can't cast a Generic to a java.lang.String
And if I try (i.e. cast the result):
my $id = cast('java.lang.String', $bo->getValue("id_number"));
I get the error:
Type casting can only be used on Java objects. Use 'coerce' instead.
But the documentation around coerce suggests that isn't what I need.
What am I doing wrong here?
Thanks,
James