use strict;use Inline Java => <<'END_OF_JAVA_CODE' ,STUDY => ['java.lang.Integer'],;
class Pod_alu { public Pod_alu(){ }
public Integer add(Integer i, Integer j){ return i + j ; } public int subtract(Integer i, Integer j){ return i - j ; } public void showInteger(Integer i){ System.out.println("Integer is " + i); } } END_OF_JAVA_CODE my $alu = new Pod_alu() ; print($alu->add(9, 16) . "\n") ; # prints 25 print($alu->subtract(9, 16) . "\n") ; # prints -7 my $int = Inline::Java::coerce('java.lang.Integer', 32); print "Int is a $int\n"; $alu->showInteger($int); $int = 400; print "Int is a $int\n"; $alu->showInteger($int); On Jul 18, 2008, at 5:00 PM, Vanole, Mike wrote:
Was: (Inline Integer question) Re: Inline Java and the Business Objects SDK I'm stuck on what I think it an integer input problem. I need to make sure that I'm replicating this Java: Integer groupInt = new Integer(iGroup.getID()); I can get a value from iGroup.getID(). That value is "2" And I make sure it's an integer (perl): $groupInt = int($iGroup->getID()); But I don't think this is a correct way to translate the Java above I think I need coerce, but I couldn't make that work. What is the correct way to ensure $groupInt is a Java integer? Thanks, Mike
-- Jason Stelzer [EMAIL PROTECTED]
PGP.sig
Description: This is a digitally signed message part