当前位置: 首页>>代码示例>>Golang>>正文


Golang Object.IsNull方法代码示例

本文整理汇总了Golang中v/io/x/jni/util.Object.IsNull方法的典型用法代码示例。如果您正苦于以下问题:Golang Object.IsNull方法的具体用法?Golang Object.IsNull怎么用?Golang Object.IsNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在v/io/x/jni/util.Object的用法示例。


在下文中一共展示了Object.IsNull方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: GoBlessingStore

// GoBlessingStore creates an instance of security.BlessingStore that uses the
// provided Java BlessingStore as its underlying implementation.
func GoBlessingStore(env jutil.Env, jBlessingStore jutil.Object) (security.BlessingStore, error) {
	if jBlessingStore.IsNull() {
		return nil, nil
	}
	if jutil.IsInstanceOf(env, jBlessingStore, jBlessingStoreImplClass) {
		// Called with our implementation of BlessingStore, which maintains a Go reference - use it.
		ref, err := jutil.JLongField(env, jBlessingStore, "nativeRef")
		if err != nil {
			return nil, err
		}
		return (*(*security.BlessingStore)(jutil.GoRefValue(jutil.Ref(ref)))), nil
	}
	// Reference Java BlessingStore; it will be de-referenced when the Go
	// BlessingStore created below is garbage-collected (through the finalizer
	// callback we setup just below).
	jBlessingStore = jutil.NewGlobalRef(env, jBlessingStore)
	s := &blessingStore{
		jBlessingStore: jBlessingStore,
	}
	runtime.SetFinalizer(s, func(s *blessingStore) {
		env, freeFunc := jutil.GetEnv()
		defer freeFunc()
		jutil.DeleteGlobalRef(env, s.jBlessingStore)
	})
	return s, nil
}
开发者ID:vanadium,项目名称:go.jni,代码行数:28,代码来源:store.go

示例2: GoCall

// GoCall creates instance of security.Call that uses the provided Java
// Call as its underlying implementation.
func GoCall(env jutil.Env, jCall jutil.Object) (security.Call, error) {
	if jCall.IsNull() {
		return nil, nil
	}
	if jutil.IsInstanceOf(env, jCall, jCallImplClass) {
		// Called with our implementation of Call, which maintains a Go reference - use it.
		ref, err := jutil.CallLongMethod(env, jCall, "nativeRef", nil)
		if err != nil {
			return nil, err
		}
		return (*(*security.Call)(jutil.GoRefValue(jutil.Ref(ref)))), nil
	}
	// Reference Java call; it will be de-referenced when the go call
	// created below is garbage-collected (through the finalizer callback we
	// setup just below).
	jCall = jutil.NewGlobalRef(env, jCall)
	call := &callImpl{
		jCall: jCall,
	}
	runtime.SetFinalizer(call, func(c *callImpl) {
		env, freeFunc := jutil.GetEnv()
		defer freeFunc()
		jutil.DeleteGlobalRef(env, c.jCall)
	})
	return call, nil
}
开发者ID:vanadium,项目名称:go.jni,代码行数:28,代码来源:call.go

示例3: GoAuthorizer

// GoAuthorizer converts the given Java authorizer into a Go authorizer.
func GoAuthorizer(env jutil.Env, jAuth jutil.Object) (security.Authorizer, error) {
	if jAuth.IsNull() {
		return nil, nil
	}
	if jutil.IsInstanceOf(env, jAuth, jPermissionsAuthorizerClass) {
		// Called with our implementation of Authorizer, which maintains a Go reference - use it.
		ref, err := jutil.JLongField(env, jAuth, "nativeRef")
		if err != nil {
			return nil, err
		}
		return *(*security.Authorizer)(jutil.GoRefValue(jutil.Ref(ref))), nil
	}
	// Reference Java dispatcher; it will be de-referenced when the go
	// dispatcher created below is garbage-collected (through the finalizer
	// callback we setup below).
	jAuth = jutil.NewGlobalRef(env, jAuth)
	a := &authorizer{
		jAuth: jAuth,
	}
	runtime.SetFinalizer(a, func(a *authorizer) {
		env, freeFunc := jutil.GetEnv()
		defer freeFunc()
		jutil.DeleteGlobalRef(env, a.jAuth)
	})
	return a, nil
}
开发者ID:vanadium,项目名称:go.jni,代码行数:27,代码来源:authorizer.go

示例4: GoPrincipal

// GoPrincipal converts the provided Java VPrincipal object into a Go Principal.
func GoPrincipal(env jutil.Env, jPrincipal jutil.Object) (security.Principal, error) {
	if jPrincipal.IsNull() {
		return nil, nil
	}
	if jutil.IsInstanceOf(env, jPrincipal, jVPrincipalImplClass) {
		// Called with our implementation of VPrincipal, which maintains a Go reference - use it.
		ref, err := jutil.CallLongMethod(env, jPrincipal, "nativeRef", nil)
		if err != nil {
			return nil, err
		}
		return (*(*security.Principal)(jutil.GoRefValue(jutil.Ref(ref)))), nil
	}

	// Reference Java VPrincipal; it will be de-referenced when the Go Principal
	// created below is garbage-collected (through the finalizer callback we
	// setup just below).
	jPrincipal = jutil.NewGlobalRef(env, jPrincipal)
	// Create Go Principal.
	p := &principal{
		jPrincipal: jPrincipal,
	}
	runtime.SetFinalizer(p, func(p *principal) {
		env, freeFunc := jutil.GetEnv()
		defer freeFunc()
		jutil.DeleteGlobalRef(env, p.jPrincipal)
	})
	return p, nil
}
开发者ID:vanadium,项目名称:go.jni,代码行数:29,代码来源:principal.go

示例5: GoPermissions

// GoPermissions converts the provided Java Permissions into a Go Permissions.
func GoPermissions(env jutil.Env, jPermissions jutil.Object) (perms access.Permissions, err error) {
	if jPermissions.IsNull() {
		return
	}
	err = jutil.GoVomCopy(env, jPermissions, jPermissionsClass, &perms)
	return
}
开发者ID:vanadium,项目名称:go.jni,代码行数:8,代码来源:util.go

示例6: GoAccessList

// GoAccessList converts the provided Java AccessList into a Go AccessList.
func GoAccessList(env jutil.Env, jAccessList jutil.Object) (acl access.AccessList, err error) {
	if jAccessList.IsNull() {
		return
	}
	err = jutil.GoVomCopy(env, jAccessList, jAccessListClass, &acl)
	return
}
开发者ID:vanadium,项目名称:go.jni,代码行数:8,代码来源:util.go

示例7: GoBlessingRoots

// GoBlessingRoots creates an instance of security.BlessingRoots that uses the
// provided Java BlessingRoots as its underlying implementation.
func GoBlessingRoots(env jutil.Env, jBlessingRoots jutil.Object) (security.BlessingRoots, error) {
	if jBlessingRoots.IsNull() {
		return nil, nil
	}
	if jutil.IsInstanceOf(env, jBlessingRoots, jBlessingRootsImplClass) {
		// Called with our implementation of BlessingRoots, which maintains a Go reference - use it.
		ref, err := jutil.CallLongMethod(env, jBlessingRoots, "nativeRef", nil)
		if err != nil {
			return nil, err
		}
		return (*(*security.BlessingRoots)(jutil.GoRefValue(jutil.Ref(ref)))), nil
	}
	// Reference Java BlessingRoots; it will be de-referenced when the Go
	// BlessingRoots created below is garbage-collected (through the finalizer
	// callback we setup just below).
	jBlessingRoots = jutil.NewGlobalRef(env, jBlessingRoots)
	r := &blessingRoots{
		jBlessingRoots: jBlessingRoots,
	}
	runtime.SetFinalizer(r, func(r *blessingRoots) {
		env, freeFunc := jutil.GetEnv()
		defer freeFunc()
		jutil.DeleteGlobalRef(env, r.jBlessingRoots)
	})
	return r, nil
}
开发者ID:vanadium,项目名称:go.jni,代码行数:28,代码来源:roots.go

示例8: GoBlessings

// GoBlessings converts the provided Java Blessings into Go Blessings.
func GoBlessings(env jutil.Env, jBlessings jutil.Object) (security.Blessings, error) {
	if jBlessings.IsNull() {
		return security.Blessings{}, nil
	}
	ref, err := jutil.CallLongMethod(env, jBlessings, "nativeRef", nil)
	if err != nil {
		return security.Blessings{}, err
	}
	return (*(*security.Blessings)(jutil.GoRefValue(jutil.Ref(ref)))), nil
}
开发者ID:vanadium,项目名称:go.jni,代码行数:11,代码来源:util.go

示例9: GoBlessingPattern

// GoBlessingPattern converts the provided Java BlessingPattern into Go BlessingPattern.
func GoBlessingPattern(env jutil.Env, jPattern jutil.Object) (pattern security.BlessingPattern, err error) {
	if jPattern.IsNull() {
		return "", nil
	}
	ref, err := jutil.CallLongMethod(env, jPattern, "nativeRef", nil)
	if err != nil {
		return "", err
	}
	return (*(*security.BlessingPattern)(jutil.GoRefValue(jutil.Ref(ref)))), nil
}
开发者ID:vanadium,项目名称:go.jni,代码行数:11,代码来源:util.go

示例10: GoContext

// GoContext converts the provided Java VContext into a Go context and
// a cancel function (if any) that can be used to cancel the context.
func GoContext(env jutil.Env, jContext jutil.Object) (*context.T, context.CancelFunc, error) {
	if jContext.IsNull() {
		return nil, nil, nil
	}
	goCtxRefVal, err := jutil.CallLongMethod(env, jContext, "nativeRef", nil)
	if err != nil {
		return nil, nil, err
	}
	goCtxRef := jutil.Ref(goCtxRefVal)
	goCancelRefVal, err := jutil.CallLongMethod(env, jContext, "nativeCancelRef", nil)
	if err != nil {
		return nil, nil, err
	}
	goCancelRef := jutil.Ref(goCancelRefVal)
	var cancel context.CancelFunc
	if goCancelRef != jutil.NullRef {
		cancel = *(*context.CancelFunc)(jutil.GoRefValue(goCancelRef))
	}
	return (*context.T)(jutil.GoRefValue(goCtxRef)), cancel, nil
}
开发者ID:vanadium,项目名称:go.jni,代码行数:22,代码来源:util.go

示例11: GoStorageEngine

// GoStorageEngine converts the provided Java SyncbaseServer.StorageEngine
// enum object into a Go storage engine string.
func GoStorageEngine(env jutil.Env, jEngine jutil.Object) (string, error) {
	if jEngine.IsNull() {
		return "leveldb", nil
	}
	return jutil.CallStringMethod(env, jEngine, "getValue", []jutil.Sign{})
}
开发者ID:vanadium,项目名称:go.jni,代码行数:8,代码来源:util.go


注:本文中的v/io/x/jni/util.Object.IsNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。