• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang types.NewName函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/timob/gojvm/types.NewName函数的典型用法代码示例。如果您正苦于以下问题:Golang NewName函数的具体用法?Golang NewName怎么用?Golang NewName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: Convert

func (j *JavaToGoSet) Convert(obj *gojvm.Object) (err error) {
	iter, err := obj.CallObj(j.env, false, "iterator", types.Class{types.NewName("java.util.Iterator")})
	if err != nil {
		return
	}
	return j.JavaToGoIterator.Convert(iter)
}
开发者ID:skanjo,项目名称:javabind,代码行数:7,代码来源:runtime.go


示例2: RegisterNative

func RegisterNative(className string, method string, paramTypes []string, returnType string, fn interface{}) {
	f := func(t string) types.Typed {
		switch t {
		case "void":
			return types.Basic(types.VoidKind)
		case "int":
			return types.Basic(types.IntKind)
		case "long":
			return types.Basic(types.LongKind)
		case "float":
			return types.Basic(types.FloatKind)
		case "double":
			return types.Basic(types.DoubleKind)
		case "boolean":
			return types.Basic(types.BoolKind)
		default:
			return types.Class{types.NewName(t)}
		}
		return types.Basic(types.VoidKind)
	}

	var msig types.MethodSignature
	for _, v := range paramTypes {
		msig.Params = append(msig.Params, f(v))
	}
	msig.Return = f(returnType)

	GetEnv().RegisterNative(className, method, msig, fn)
}
开发者ID:skanjo,项目名称:javabind,代码行数:29,代码来源:runtime.go


示例3: NewInstanceStr

/*
	returns a new *Object of the class named by 'klass' (Wrapper around NewInstance(types.NewName(...)))
*/
func (self *Environment) NewInstanceStr(klass string, params ...interface{}) (obj *Object, err error) {
	class, err := self.GetClass(types.NewName(klass))
	if err != nil {
		return
	}
	return self.NewInstance(class, params...)
}
开发者ID:timob,项目名称:gojvm,代码行数:10,代码来源:environ.c.go


示例4: GetName

/*
	returns the (potentially cached) types.Name of the class.
*/
func (self *Class) GetName(env *Environment) (name types.Name, err error) {
	//log.Printf("Name(miss)")
	var cstr string
	cstr, _, err = self.CallString(env, false, "getName")
	if err == nil {
		name = types.NewName(cstr)
	}
	return
}
开发者ID:timob,项目名称:gojvm,代码行数:12,代码来源:class.c.go


示例5: CallStaticObj

func CallStaticObj(class string, method string, retType interface{}, args ...interface{}) (*gojvm.Object, error) {
	var t types.Typed
	switch v := retType.(type) {
	case string:
		t = types.Class{types.NewName(v)}
	case types.Typed:
		t = v
	default:
		panic("Callable.callObj unknown retType type")
	}

	env := GetEnv()
	cls, err := env.GetClass(types.NewName(class))
	if err != nil {
		return nil, err
	}

	return cls.CallObj(env, true, method, t, args...)
}
开发者ID:skanjo,项目名称:javabind,代码行数:19,代码来源:runtime.go


示例6: CallStaticIntArray

func CallStaticIntArray(class string, method string, args ...interface{}) ([]int, error) {
	env := GetEnv()

	cls, err := env.GetClass(types.NewName(class))
	if err != nil {
		return nil, err
	}

	return cls.CallIntArray(env, true, method, args...)
}
开发者ID:skanjo,项目名称:javabind,代码行数:10,代码来源:runtime.go


示例7: GetFieldStaticBoolean

func GetFieldStaticBoolean(class string, fieldName string) (bool, error) {
	env := GetEnv()

	cls, err := env.GetClass(types.NewName(class))
	if err != nil {
		return false, err
	}

	return cls.GetBooleanField(env, true, fieldName)
}
开发者ID:skanjo,项目名称:javabind,代码行数:10,代码来源:runtime.go


示例8: CallStaticDouble

func CallStaticDouble(class string, method string, args ...interface{}) (float64, error) {
	env := GetEnv()

	cls, err := env.GetClass(types.NewName(class))
	if err != nil {
		return 0, err
	}

	return cls.CallDouble(env, true, method, args...)
}
开发者ID:skanjo,项目名称:javabind,代码行数:10,代码来源:runtime.go


示例9: GetFieldStaticDouble

func GetFieldStaticDouble(class string, fieldName string) (float64, error) {
	env := GetEnv()

	cls, err := env.GetClass(types.NewName(class))
	if err != nil {
		return 0, err
	}

	return cls.GetDoubleField(env, true, fieldName)
}
开发者ID:skanjo,项目名称:javabind,代码行数:10,代码来源:runtime.go


示例10: CallStaticBoolean

func CallStaticBoolean(class string, method string, args ...interface{}) (bool, error) {
	env := GetEnv()

	cls, err := env.GetClass(types.NewName(class))
	if err != nil {
		return false, err
	}

	return cls.CallBoolean(env, true, method, args...)
}
开发者ID:skanjo,项目名称:javabind,代码行数:10,代码来源:runtime.go


示例11: GetFieldStaticInt

func GetFieldStaticInt(class string, fieldName string) (int, error) {
	env := GetEnv()

	cls, err := env.GetClass(types.NewName(class))
	if err != nil {
		return 0, err
	}

	return cls.GetIntField(env, true, fieldName)
}
开发者ID:skanjo,项目名称:javabind,代码行数:10,代码来源:runtime.go


示例12: CallStaticVoid

func CallStaticVoid(class string, method string, args ...interface{}) error {
	env := GetEnv()

	cls, err := env.GetClass(types.NewName(class))
	if err != nil {
		return err
	}

	return cls.CallVoid(env, true, method, args...)
}
开发者ID:skanjo,项目名称:javabind,代码行数:10,代码来源:runtime.go


示例13: GetFieldStaticObj

func GetFieldStaticObj(class string, fieldName string, retType interface{}) (*gojvm.Object, error) {
	env := GetEnv()

	var t types.Typed
	switch v := retType.(type) {
	case string:
		t = types.Class{types.NewName(v)}
	case types.Typed:
		t = v
	default:
		panic("Callable.callObj unknown retType type")
	}

	cls, err := env.GetClass(types.NewName(class))
	if err != nil {
		return nil, err
	}

	return cls.GetObjField(env, true, fieldName, t)
}
开发者ID:skanjo,项目名称:javabind,代码行数:20,代码来源:runtime.go


示例14: CallStaticObjArray

func CallStaticObjArray(class string, method string, retType interface{}, args ...interface{}) (*gojvm.Object, error) {
	var t types.Typed
	switch v := retType.(type) {
	case string:
		t = types.Array{types.Class{types.NewName(v)}}
	case types.Typed:
		t = v
	default:
		panic("Callable.callObj unknown retType type")
	}
	return CallStaticObj(class, method, t, args...)
}
开发者ID:skanjo,项目名称:javabind,代码行数:12,代码来源:runtime.go


示例15: CallObjArray

func (c *Callable) CallObjArray(method string, retType interface{}, args ...interface{}) (*gojvm.Object, error) {
	var t types.Typed
	switch v := retType.(type) {
	case string:
		t = types.Array{types.Class{types.NewName(v)}}
	case types.Typed:
		t = v
	default:
		panic("Callable.callObj unknown retType type")
	}
	return c.Obj.CallObj(GetEnv(), false, method, t, args...)
}
开发者ID:skanjo,项目名称:javabind,代码行数:12,代码来源:runtime.go


示例16: SetFieldObj

func (c *Callable) SetFieldObj(fieldName string, retType interface{}, val interface{}) error {
	var t types.Typed
	switch v := retType.(type) {
	case string:
		t = types.Class{types.NewName(v)}
	case types.Typed:
		t = v
	default:
		panic("Callable.callObj unknown retType type")
	}

	return c.Obj.SetObjField(GetEnv(), false, fieldName, t, val.(CallableContainer).getCallable().Obj)
}
开发者ID:skanjo,项目名称:javabind,代码行数:13,代码来源:runtime.go


示例17: GetFieldObjArray

func (c *Callable) GetFieldObjArray(fieldName string, retType interface{}) (*gojvm.Object, error) {
	var t types.Typed
	switch v := retType.(type) {
	case string:
		t = types.Array{types.Class{types.NewName(v)}}
	case types.Typed:
		t = v
	default:
		panic("Callable.callObj unknown retType type")
	}

	return c.Obj.GetObjField(GetEnv(), false, fieldName, t)
}
开发者ID:skanjo,项目名称:javabind,代码行数:13,代码来源:runtime.go


示例18: RegisterNative

func (self *Environment) RegisterNative(className string, method string, sig types.MethodSignature, fptr interface{}) error {
	class, err := self.GetClass(types.NewName(className))
	if err != nil {
		return err
	}
	cname := C.CString(method)
	defer C.free(unsafe.Pointer(cname))

	csig := C.CString(sig.String())
	defer C.free(unsafe.Pointer(csig))
	C.envRegisterNative(self.env, class.class, cname, csig, fptr.(unsafe.Pointer))

	return nil
}
开发者ID:timob,项目名称:gojvm,代码行数:14,代码来源:environ.c.go


示例19: Name

/*
	Returns the (potentially cached) name of the ObjectClass of the
	named object.
*/
func (self *Object) Name(env *Environment) (name types.Name, err error) {
	clsObj, err := self.CallObj(env, false, "getClass", types.Class{ClassClass})
	if err != nil {
		return
	}

	nameStr, _, err := clsObj.CallString(env, false, "getName")
	if err != nil {
		return
	}
	return types.NewName(nameStr), nil
	/*
		var c *Class
		c, err = clsObj.ObjectClass(env)
		if err == nil {
			defer env.DeleteLocalClassRef(c)
			name, err = c.GetName(env)
		} else {
			log.Printf("Couldn't get object class!")
		}
		return
	*/
}
开发者ID:timob,项目名称:gojvm,代码行数:27,代码来源:object.c.go


示例20: GetClassStr

// Wrapper around GetClass(types.NewName(...))
func (self *Environment) GetClassStr(klass string) (c *Class, err error) {
	class := types.NewName(klass)
	return self.GetClass(class)
}
开发者ID:timob,项目名称:gojvm,代码行数:5,代码来源:environ.c.go



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang errors.BpTreeError函数代码示例发布时间:2022-05-28
下一篇:
Golang types.Basic函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap