예제 #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
}