@@ -9,6 +9,94 @@ namespace Xamarin.Test {
9
9
[ global ::Android . Runtime . Register ( "xamarin/test/PublicClass" , DoNotGenerateAcw = true ) ]
10
10
public partial class PublicClass : global ::Java . Lang . Object {
11
11
12
+ // Metadata.xml XPath interface reference: path="/api/package[@name='xamarin.test']/interface[@name='PublicClass.ProtectedInterface']"
13
+ [ Register ( "xamarin/test/PublicClass$ProtectedInterface" , "" , "Xamarin.Test.PublicClass/IProtectedInterfaceInvoker" ) ]
14
+ protected internal partial interface IProtectedInterface : IJavaObject , IJavaPeerable {
15
+
16
+ // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/interface[@name='PublicClass.ProtectedInterface']/method[@name='foo' and count(parameter)=0]"
17
+ [ Register ( "foo" , "()V" , "GetFooHandler:Xamarin.Test.PublicClass/IProtectedInterfaceInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" ) ]
18
+ void Foo ( ) ;
19
+
20
+ }
21
+
22
+ [ global ::Android . Runtime . Register ( "xamarin/test/PublicClass$ProtectedInterface" , DoNotGenerateAcw = true ) ]
23
+ internal partial class IProtectedInterfaceInvoker : global ::Java . Lang . Object , IProtectedInterface {
24
+
25
+ static readonly JniPeerMembers _members = new JniPeerMembers ( "xamarin/test/PublicClass$ProtectedInterface" , typeof ( IProtectedInterfaceInvoker ) ) ;
26
+
27
+ static IntPtr java_class_ref {
28
+ get { return _members . JniPeerType . PeerReference . Handle ; }
29
+ }
30
+
31
+ public override global ::Java . Interop . JniPeerMembers JniPeerMembers {
32
+ get { return _members ; }
33
+ }
34
+
35
+ protected override IntPtr ThresholdClass {
36
+ get { return class_ref ; }
37
+ }
38
+
39
+ protected override global ::System . Type ThresholdType {
40
+ get { return _members . ManagedPeerType ; }
41
+ }
42
+
43
+ new IntPtr class_ref ;
44
+
45
+ public static IProtectedInterface GetObject ( IntPtr handle , JniHandleOwnership transfer )
46
+ {
47
+ return global ::Java . Lang . Object . GetObject < IProtectedInterface > ( handle , transfer ) ;
48
+ }
49
+
50
+ static IntPtr Validate ( IntPtr handle )
51
+ {
52
+ if ( ! JNIEnv . IsInstanceOf ( handle , java_class_ref ) )
53
+ throw new InvalidCastException ( string . Format ( "Unable to convert instance of type '{0}' to type '{1}'." ,
54
+ JNIEnv . GetClassNameFromInstance ( handle ) , "xamarin.test.PublicClass.ProtectedInterface" ) ) ;
55
+ return handle ;
56
+ }
57
+
58
+ protected override void Dispose ( bool disposing )
59
+ {
60
+ if ( this . class_ref != IntPtr . Zero )
61
+ JNIEnv . DeleteGlobalRef ( this . class_ref ) ;
62
+ this . class_ref = IntPtr . Zero ;
63
+ base . Dispose ( disposing ) ;
64
+ }
65
+
66
+ public IProtectedInterfaceInvoker ( IntPtr handle , JniHandleOwnership transfer ) : base ( Validate ( handle ) , transfer )
67
+ {
68
+ IntPtr local_ref = JNIEnv . GetObjectClass ( ( ( global ::Java . Lang . Object ) this ) . Handle ) ;
69
+ this . class_ref = JNIEnv . NewGlobalRef ( local_ref ) ;
70
+ JNIEnv . DeleteLocalRef ( local_ref ) ;
71
+ }
72
+
73
+ static Delegate cb_foo ;
74
+ #pragma warning disable 0169
75
+ static Delegate GetFooHandler ( )
76
+ {
77
+ if ( cb_foo == null )
78
+ cb_foo = JNINativeWrapper . CreateDelegate ( ( Action < IntPtr , IntPtr > ) n_Foo ) ;
79
+ return cb_foo ;
80
+ }
81
+
82
+ static void n_Foo ( IntPtr jnienv , IntPtr native__this )
83
+ {
84
+ global ::Xamarin . Test . PublicClass . IProtectedInterface __this = global ::Java . Lang . Object . GetObject < global ::Xamarin . Test . PublicClass . IProtectedInterface > ( jnienv , native__this , JniHandleOwnership . DoNotTransfer ) ;
85
+ __this . Foo ( ) ;
86
+ }
87
+ #pragma warning restore 0169
88
+
89
+ IntPtr id_foo ;
90
+ public unsafe void Foo ( )
91
+ {
92
+ if ( id_foo == IntPtr . Zero )
93
+ id_foo = JNIEnv . GetMethodID ( class_ref , "foo" , "()V" ) ;
94
+ JNIEnv . CallVoidMethod ( ( ( global ::Java . Lang . Object ) this ) . Handle , id_foo ) ;
95
+ }
96
+
97
+ }
98
+
99
+
12
100
static readonly JniPeerMembers _members = new JniPeerMembers ( "xamarin/test/PublicClass" , typeof ( PublicClass ) ) ;
13
101
internal static new IntPtr class_ref {
14
102
get {
0 commit comments