MCPcopy Create free account
hub / github.com/golang/mobile / toJavaType

Method toJavaType

bind/genjava.go:106–142  ·  view source on GitHub ↗
(T types.Type)

Source from the content-addressed store, hash-verified

104}
105
106func (j *javaClassInfo) toJavaType(T types.Type) *java.Type {
107 switch T := T.(type) {
108 case *types.Basic:
109 var kind java.TypeKind
110 switch T.Kind() {
111 case types.Bool, types.UntypedBool:
112 kind = java.Boolean
113 case types.Uint8:
114 kind = java.Byte
115 case types.Int16:
116 kind = java.Short
117 case types.Int32, types.UntypedRune: // types.Rune
118 kind = java.Int
119 case types.Int64, types.UntypedInt:
120 kind = java.Long
121 case types.Float32:
122 kind = java.Float
123 case types.Float64, types.UntypedFloat:
124 kind = java.Double
125 case types.String, types.UntypedString:
126 kind = java.String
127 default:
128 return nil
129 }
130 return &java.Type{Kind: kind}
131 case *types.Slice:
132 if isBytesSlice(T) {
133 return &java.Type{Kind: java.Array, Elem: &java.Type{Kind: java.Byte}}
134 }
135 return nil
136 case *types.Named:
137 if isJavaType(T) {
138 return &java.Type{Kind: java.Object, Class: classNameFor(T)}
139 }
140 }
141 return nil
142}
143
144// lookupMethod searches the Java class descriptor for a method
145// that matches the Go method.

Callers 1

lookupMethodMethod · 0.95

Calls 3

isBytesSliceFunction · 0.85
isJavaTypeFunction · 0.85
classNameForFunction · 0.85

Tested by

no test coverage detected