Пример #1
0
func (self *Environment) _objMethod(obj *Object, name string, jt types.Typed, params ...interface{}) (meth *Method, err error) {
	class, err := self.GetObjectClass(obj)
	defer self.DeleteLocalClassRef(class)
	if err != nil {
		return
	}
	form, err := FormFor(self, jt, params...)
	if err != nil {
		return
	}

	cmethod := C.CString(name)
	defer C.free(unsafe.Pointer(cmethod))
	cform := C.CString(form)
	defer C.free(unsafe.Pointer(cform))

	if debug {
		log.Printf("_objMethod %V %V", name, form)
	}
	m := C.envGetMethodID(self.env, class.class, cmethod, cform)
	if m == nil {
		err = self.ExceptionOccurred()
	} else {
		meth = &Method{m}
	}
	return

}
Пример #2
0
func (self *Environment) _classMethod(class *Class, name string, jt types.Typed, params ...interface{}) (meth *Method, err error) {
	form, err := FormFor(self, jt, params...)
	if err != nil {
		return
	}
	cmethod := C.CString(name)
	defer C.free(unsafe.Pointer(cmethod))
	cform := C.CString(form)
	defer C.free(unsafe.Pointer(cform))
	//cname, err := class.Name()
	//if err != nil { return }
	m := C.envGetMethodID(self.env, class.class, cmethod, cform)
	if m == nil {
		err = self.ExceptionOccurred()
	} else {
		meth = &Method{m}
	}
	return
}