blob: 8c1eab4bfd869fdd14e424e77e072624f771c12d [file] [log] [blame]
khenaidoo7d3c5582021-08-11 18:09:44 -04001// Copyright 2019 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package impl
6
7import (
8 "reflect"
9
10 pref "google.golang.org/protobuf/reflect/protoreflect"
11)
12
13type EnumInfo struct {
14 GoReflectType reflect.Type // int32 kind
15 Desc pref.EnumDescriptor
16}
17
18func (t *EnumInfo) New(n pref.EnumNumber) pref.Enum {
19 return reflect.ValueOf(n).Convert(t.GoReflectType).Interface().(pref.Enum)
20}
21func (t *EnumInfo) Descriptor() pref.EnumDescriptor { return t.Desc }