package com.schooner.test;
public class JumpClass {
private static JumpClass instance = null;
private JumpClass(){
}
public static synchronized JumpClass getInstance(){
if ( instance == null ) {
instance = new JumpClass();
}
return instance;
}
}
####
import com.schooner.test.JumpClass;
|
| Waving of hands....
|
JumpClass j = JumpClass.getInstance();
|
|
####
#!/usr/bin/perl -w
use strict;
use Data::Dumper;
use Inline (
Java => 'STUDY',
STUDY => [ qw / com.schooner.test.JumpClass / ],
AUTOSTUDY => 1,
CLASSPATH=> '.'
);
my $jc = JumpClass::getInstance();
####
Undefined subroutine &JumpClass::GetInstance called at jtest.pl line 42.
####
my $jc=main::com::schooner::test::JumpClass::getInstance();
####
Can't call method "__validate_prototype" on an undefined value at (eval 11) line 45.
####
#!/usr/bin/perl -w
use strict;
use Data::Dumper;
use Inline (
Java => 'STUDY',
STUDY => [ qw / com.schooner.test.JumpClass / ],
AUTOSTUDY => 1,
CLASSPATH=> '.'
);
use Inline (
Java => qq(
import com.schooner.test.JumpClass;
public class SingletonWrapper {
public SingletonWrapper(){}
public JumpClass getInstance(){
JumpClass j = JumpClass.getInstance();
return j;
}
}
),
CLASSPATH => "."
);
my $jc =(new SingletonWrapper())->getInstance();
# print Dumper($jc);
#my $jc=main::com::schooner::test::JumpClass::getInstance();
print Dumper($jc);
####
$VAR1 = bless( {}, 'main::com::schooner::test::JumpClass' );