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


Golang types.NewName函数代码示例

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


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


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