func (self *Environment) getObjectField(o *Object, static bool, mname string, rType types.Typed) (meth *Field, err error) { class, err := self.GetObjectClass(o) defer self.DeleteLocalClassRef(class) if err != nil { return } cmethod := C.CString(mname) defer C.free(unsafe.Pointer(cmethod)) cform := C.CString(rType.TypeString()) defer C.free(unsafe.Pointer(cform)) var m C.jfieldID if static { //todo } else { m = C.envGetFieldID(self.env, class.class, cmethod, cform) } if m == nil { err = self.ExceptionOccurred() return nil, err } return &Field{m}, nil }
/* Returns the signature string for the configured environment, return type and parameters (exported for convenience) ; Reflection is handled by ParameterString */ func FormFor(ctx *Environment, ret types.Typed, params ...interface{}) (s string, err error) { s, err = ParameterString(ctx, params...) if err == nil { s = s + ret.TypeString() } return }
func (self *Environment) getClassField(c *Class, static bool, mname string, rType types.Typed) (meth *Field, err error) { cmethod := C.CString(mname) defer C.free(unsafe.Pointer(cmethod)) cform := C.CString(rType.TypeString()) defer C.free(unsafe.Pointer(cform)) var m C.jfieldID if !static { //todo } else { m = C.envGetStaticFieldID(self.env, c.class, cmethod, cform) } if m == nil { err = self.ExceptionOccurred() return nil, err } return &Field{m}, nil }