Exemplo n.º 1
0
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
}
Exemplo n.º 2
0
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
}