示例#1
0
文件: environ.c.go 项目: timob/gojvm
func (self *Environment) getObjField(z interface{}, static bool, name string, rval types.Typed) (v *Object, err error) {
	jval, field, err := self.getField(z, static, name, rval)
	if err != nil {
		return
	}
	var oval C.jobject
	if static {
		oval = C.envGetStaticObjectField(self.env, C.valObject(jval), field.field)
	} else {
		oval = C.envGetObjectField(self.env, C.valObject(jval), field.field)
	}
	if self.ExceptionCheck() {
		err = self.ExceptionOccurred()
	}
	if err == nil {
		v = &Object{oval}
	}
	return
}
示例#2
0
文件: environ.c.go 项目: timob/gojvm
func (self *Environment) getIntArrayField(z interface{}, static bool, name string) (v []int, err error) {
	jval, field, err := self.getField(z, static, name, types.Array{types.Basic(types.IntKind)})
	if err != nil {
		return
	}
	var oval C.jobject
	if static {
		oval = C.envGetStaticObjectField(self.env, C.valObject(jval), field.field)
	} else {
		oval = C.envGetObjectField(self.env, C.valObject(jval), field.field)
	}
	if oval == nil {
		err = self.ExceptionOccurred()
	}
	if err == nil {
		v = self.ToIntArray(newObject(oval))
	}

	return
}