github.com/F4RD1N/gomobile@v1.0.1/bind/testdata/java.go.golden (about) 1 // Code generated by gobind. DO NOT EDIT. 2 3 package Float 4 5 import "Java" 6 7 const _ = Java.Dummy 8 9 const ( 10 MAX_VALUE = 3.4028235E38 11 MIN_NORMAL = 1.17549435E-38 12 MIN_VALUE = 1.4E-45 13 MAX_EXPONENT = 127 14 MIN_EXPONENT = -126 15 SIZE = 32 16 BYTES = 4 17 ) 18 19 var ( 20 // Cast takes a proxy for a Java object and converts it to a java.lang.Float proxy. 21 // Cast panics if the argument is not a proxy or if the underlying object does 22 // not extend or implement java.lang.Float. 23 Cast func(v interface{}) Java.Java_lang_Float 24 ) 25 // Code generated by gobind. DO NOT EDIT. 26 27 package lang 28 29 import "Java" 30 31 const _ = Java.Dummy 32 33 type Float Java.Java_lang_Float 34 type Long Java.Java_lang_Long 35 type Object Java.Java_lang_Object 36 type Runnable Java.Java_lang_Runnable 37 // Code generated by gobind. DO NOT EDIT. 38 39 package Long 40 41 import "Java" 42 43 const _ = Java.Dummy 44 45 const ( 46 MIN_VALUE = -9223372036854775808 47 MAX_VALUE = 9223372036854775807 48 SIZE = 64 49 BYTES = 8 50 ) 51 52 var ( 53 // Cast takes a proxy for a Java object and converts it to a java.lang.Long proxy. 54 // Cast panics if the argument is not a proxy or if the underlying object does 55 // not extend or implement java.lang.Long. 56 Cast func(v interface{}) Java.Java_lang_Long 57 ) 58 // Code generated by gobind. DO NOT EDIT. 59 60 package Object 61 62 import "Java" 63 64 const _ = Java.Dummy 65 66 const () 67 68 var ( 69 // Cast takes a proxy for a Java object and converts it to a java.lang.Object proxy. 70 // Cast panics if the argument is not a proxy or if the underlying object does 71 // not extend or implement java.lang.Object. 72 Cast func(v interface{}) Java.Java_lang_Object 73 ) 74 // Code generated by gobind. DO NOT EDIT. 75 76 package Runnable 77 78 import "Java" 79 80 const _ = Java.Dummy 81 82 const () 83 84 var ( 85 // Cast takes a proxy for a Java object and converts it to a java.lang.Runnable proxy. 86 // Cast panics if the argument is not a proxy or if the underlying object does 87 // not extend or implement java.lang.Runnable. 88 Cast func(v interface{}) Java.Java_lang_Runnable 89 ) 90 // Code generated by gobind. DO NOT EDIT. 91 92 package Java 93 94 // Used to silence this package not used errors 95 const Dummy = 0 96 97 type Java_lang_Float interface { 98 ToString() string 99 } 100 101 type Java_lang_Long interface { 102 ToString() string 103 } 104 105 type Java_lang_Object interface { 106 ToString() string 107 } 108 109 type Java_lang_Runnable interface { 110 } 111 // Code generated by gobind. DO NOT EDIT. 112 113 package main 114 115 /* 116 #include <stdlib.h> // for free() 117 #include <jni.h> 118 #include "seq.h" 119 #include "classes.h" 120 */ 121 import "C" 122 123 import ( 124 "Java" 125 _seq "github.com/F4RD1N/gomobile/bind/seq" 126 ) 127 128 import "Java/java/lang/Float" 129 import "Java/java/lang/Long" 130 import "Java/java/lang/Object" 131 import "Java/java/lang/Runnable" 132 import "unsafe" 133 134 import "reflect" 135 136 import "fmt" 137 138 type proxy interface{ Bind_proxy_refnum__() int32 } 139 140 // Suppress unused package error 141 142 var _ = _seq.FromRefNum 143 144 const _ = Java.Dummy 145 146 //export initClasses 147 func initClasses() { 148 C.init_proxies() 149 init_java_lang_Float() 150 init_java_lang_Long() 151 init_java_lang_Object() 152 init_java_lang_Runnable() 153 } 154 155 var class_java_lang_Float C.jclass 156 157 func init_java_lang_Float() { 158 cls := C.CString("java/lang/Float") 159 clazz := C.go_seq_find_class(cls) 160 C.free(unsafe.Pointer(cls)) 161 if uintptr(clazz) == 0 { 162 return 163 } 164 class_java_lang_Float = clazz 165 Float.Cast = func(v interface{}) Java.Java_lang_Float { 166 t := reflect.TypeOf((*proxy_class_java_lang_Float)(nil)) 167 cv := reflect.ValueOf(v).Convert(t).Interface().(*proxy_class_java_lang_Float) 168 ref := C.jint(_seq.ToRefNum(cv)) 169 if C.go_seq_isinstanceof(ref, class_java_lang_Float) != 1 { 170 panic(fmt.Errorf("%T is not an instance of %s", v, "java.lang.Float")) 171 } 172 return cv 173 } 174 } 175 176 type proxy_class_java_lang_Float _seq.Ref 177 178 func (p *proxy_class_java_lang_Float) Bind_proxy_refnum__() int32 { 179 return (*_seq.Ref)(p).Bind_IncNum() 180 } 181 182 func (p *proxy_class_java_lang_Float) ToString() string { 183 res := C.cproxy_java_lang_Float_toString(C.jint(p.Bind_proxy_refnum__())) 184 _res := decodeString(res.res) 185 var _exc error 186 _exc_ref := _seq.FromRefNum(int32(res.exc)) 187 if _exc_ref != nil { 188 if res.exc < 0 { // go object 189 _exc = _exc_ref.Get().(error) 190 } else { // foreign object 191 _exc = (*proxy_error)(_exc_ref) 192 } 193 } 194 if _exc != nil { 195 panic(_exc) 196 } 197 return _res 198 } 199 200 var class_java_lang_Long C.jclass 201 202 func init_java_lang_Long() { 203 cls := C.CString("java/lang/Long") 204 clazz := C.go_seq_find_class(cls) 205 C.free(unsafe.Pointer(cls)) 206 if uintptr(clazz) == 0 { 207 return 208 } 209 class_java_lang_Long = clazz 210 Long.Cast = func(v interface{}) Java.Java_lang_Long { 211 t := reflect.TypeOf((*proxy_class_java_lang_Long)(nil)) 212 cv := reflect.ValueOf(v).Convert(t).Interface().(*proxy_class_java_lang_Long) 213 ref := C.jint(_seq.ToRefNum(cv)) 214 if C.go_seq_isinstanceof(ref, class_java_lang_Long) != 1 { 215 panic(fmt.Errorf("%T is not an instance of %s", v, "java.lang.Long")) 216 } 217 return cv 218 } 219 } 220 221 type proxy_class_java_lang_Long _seq.Ref 222 223 func (p *proxy_class_java_lang_Long) Bind_proxy_refnum__() int32 { 224 return (*_seq.Ref)(p).Bind_IncNum() 225 } 226 227 func (p *proxy_class_java_lang_Long) ToString() string { 228 res := C.cproxy_java_lang_Long_toString(C.jint(p.Bind_proxy_refnum__())) 229 _res := decodeString(res.res) 230 var _exc error 231 _exc_ref := _seq.FromRefNum(int32(res.exc)) 232 if _exc_ref != nil { 233 if res.exc < 0 { // go object 234 _exc = _exc_ref.Get().(error) 235 } else { // foreign object 236 _exc = (*proxy_error)(_exc_ref) 237 } 238 } 239 if _exc != nil { 240 panic(_exc) 241 } 242 return _res 243 } 244 245 var class_java_lang_Object C.jclass 246 247 func init_java_lang_Object() { 248 cls := C.CString("java/lang/Object") 249 clazz := C.go_seq_find_class(cls) 250 C.free(unsafe.Pointer(cls)) 251 if uintptr(clazz) == 0 { 252 return 253 } 254 class_java_lang_Object = clazz 255 Object.Cast = func(v interface{}) Java.Java_lang_Object { 256 t := reflect.TypeOf((*proxy_class_java_lang_Object)(nil)) 257 cv := reflect.ValueOf(v).Convert(t).Interface().(*proxy_class_java_lang_Object) 258 ref := C.jint(_seq.ToRefNum(cv)) 259 if C.go_seq_isinstanceof(ref, class_java_lang_Object) != 1 { 260 panic(fmt.Errorf("%T is not an instance of %s", v, "java.lang.Object")) 261 } 262 return cv 263 } 264 } 265 266 type proxy_class_java_lang_Object _seq.Ref 267 268 func (p *proxy_class_java_lang_Object) Bind_proxy_refnum__() int32 { 269 return (*_seq.Ref)(p).Bind_IncNum() 270 } 271 272 func (p *proxy_class_java_lang_Object) ToString() string { 273 res := C.cproxy_java_lang_Object_toString(C.jint(p.Bind_proxy_refnum__())) 274 _res := decodeString(res.res) 275 var _exc error 276 _exc_ref := _seq.FromRefNum(int32(res.exc)) 277 if _exc_ref != nil { 278 if res.exc < 0 { // go object 279 _exc = _exc_ref.Get().(error) 280 } else { // foreign object 281 _exc = (*proxy_error)(_exc_ref) 282 } 283 } 284 if _exc != nil { 285 panic(_exc) 286 } 287 return _res 288 } 289 290 var class_java_lang_Runnable C.jclass 291 292 func init_java_lang_Runnable() { 293 cls := C.CString("java/lang/Runnable") 294 clazz := C.go_seq_find_class(cls) 295 C.free(unsafe.Pointer(cls)) 296 if uintptr(clazz) == 0 { 297 return 298 } 299 class_java_lang_Runnable = clazz 300 Runnable.Cast = func(v interface{}) Java.Java_lang_Runnable { 301 t := reflect.TypeOf((*proxy_class_java_lang_Runnable)(nil)) 302 cv := reflect.ValueOf(v).Convert(t).Interface().(*proxy_class_java_lang_Runnable) 303 ref := C.jint(_seq.ToRefNum(cv)) 304 if C.go_seq_isinstanceof(ref, class_java_lang_Runnable) != 1 { 305 panic(fmt.Errorf("%T is not an instance of %s", v, "java.lang.Runnable")) 306 } 307 return cv 308 } 309 } 310 311 type proxy_class_java_lang_Runnable _seq.Ref 312 313 func (p *proxy_class_java_lang_Runnable) Bind_proxy_refnum__() int32 { 314 return (*_seq.Ref)(p).Bind_IncNum() 315 } 316 // Code generated by gobind. DO NOT EDIT. 317 318 // Package main is an autogenerated binder stub for package java. 319 // 320 // autogenerated by gobind -lang=go java 321 package main 322 323 /* 324 #include <stdlib.h> 325 #include <stdint.h> 326 #include "seq.h" 327 #include "java.h" 328 329 */ 330 import "C" 331 332 import ( 333 _seq "github.com/F4RD1N/gomobile/bind/seq" 334 "java" 335 ) 336 337 // suppress the error if seq ends up unused 338 var _ = _seq.FromRefNum 339 340 //export proxyjava_F_ToString 341 func proxyjava_F_ToString(refnum C.int32_t) C.nstring { 342 ref := _seq.FromRefNum(int32(refnum)) 343 v := ref.Get().(java.F) 344 res_0 := v.ToString() 345 _res_0 := encodeString(res_0) 346 return _res_0 347 } 348 349 type proxyjava_F _seq.Ref 350 351 func (p *proxyjava_F) Bind_proxy_refnum__() int32 { 352 return (*_seq.Ref)(p).Bind_IncNum() 353 } 354 355 func (p *proxyjava_F) ToString() string { 356 res := C.cproxyjava_F_ToString(C.int32_t(p.Bind_proxy_refnum__())) 357 _res := decodeString(res) 358 return _res 359 } 360 361 //export proxyjava_L_ToString 362 func proxyjava_L_ToString(refnum C.int32_t) C.nstring { 363 ref := _seq.FromRefNum(int32(refnum)) 364 v := ref.Get().(java.L) 365 res_0 := v.ToString() 366 _res_0 := encodeString(res_0) 367 return _res_0 368 } 369 370 type proxyjava_L _seq.Ref 371 372 func (p *proxyjava_L) Bind_proxy_refnum__() int32 { 373 return (*_seq.Ref)(p).Bind_IncNum() 374 } 375 376 func (p *proxyjava_L) ToString() string { 377 res := C.cproxyjava_L_ToString(C.int32_t(p.Bind_proxy_refnum__())) 378 _res := decodeString(res) 379 return _res 380 } 381 382 //export proxyjava_O_ToString 383 func proxyjava_O_ToString(refnum C.int32_t) C.nstring { 384 ref := _seq.FromRefNum(int32(refnum)) 385 v := ref.Get().(java.O) 386 res_0 := v.ToString() 387 _res_0 := encodeString(res_0) 388 return _res_0 389 } 390 391 type proxyjava_O _seq.Ref 392 393 func (p *proxyjava_O) Bind_proxy_refnum__() int32 { 394 return (*_seq.Ref)(p).Bind_IncNum() 395 } 396 397 func (p *proxyjava_O) ToString() string { 398 res := C.cproxyjava_O_ToString(C.int32_t(p.Bind_proxy_refnum__())) 399 _res := decodeString(res) 400 return _res 401 } 402 403 type proxyjava_R _seq.Ref 404 405 func (p *proxyjava_R) Bind_proxy_refnum__() int32 { 406 return (*_seq.Ref)(p).Bind_IncNum() 407 }