http urls monitor.

safe_type.go 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package reflect2
  2. import (
  3. "reflect"
  4. "unsafe"
  5. )
  6. type safeType struct {
  7. reflect.Type
  8. cfg *frozenConfig
  9. }
  10. func (type2 *safeType) New() interface{} {
  11. return reflect.New(type2.Type).Interface()
  12. }
  13. func (type2 *safeType) UnsafeNew() unsafe.Pointer {
  14. panic("does not support unsafe operation")
  15. }
  16. func (type2 *safeType) Elem() Type {
  17. return type2.cfg.Type2(type2.Type.Elem())
  18. }
  19. func (type2 *safeType) Type1() reflect.Type {
  20. return type2.Type
  21. }
  22. func (type2 *safeType) PackEFace(ptr unsafe.Pointer) interface{} {
  23. panic("does not support unsafe operation")
  24. }
  25. func (type2 *safeType) Implements(thatType Type) bool {
  26. return type2.Type.Implements(thatType.Type1())
  27. }
  28. func (type2 *safeType) RType() uintptr {
  29. panic("does not support unsafe operation")
  30. }
  31. func (type2 *safeType) Indirect(obj interface{}) interface{} {
  32. return reflect.Indirect(reflect.ValueOf(obj)).Interface()
  33. }
  34. func (type2 *safeType) UnsafeIndirect(ptr unsafe.Pointer) interface{} {
  35. panic("does not support unsafe operation")
  36. }
  37. func (type2 *safeType) LikePtr() bool {
  38. panic("does not support unsafe operation")
  39. }
  40. func (type2 *safeType) IsNullable() bool {
  41. return IsNullable(type2.Kind())
  42. }
  43. func (type2 *safeType) IsNil(obj interface{}) bool {
  44. if obj == nil {
  45. return true
  46. }
  47. return reflect.ValueOf(obj).Elem().IsNil()
  48. }
  49. func (type2 *safeType) UnsafeIsNil(ptr unsafe.Pointer) bool {
  50. panic("does not support unsafe operation")
  51. }
  52. func (type2 *safeType) Set(obj interface{}, val interface{}) {
  53. reflect.ValueOf(obj).Elem().Set(reflect.ValueOf(val).Elem())
  54. }
  55. func (type2 *safeType) UnsafeSet(ptr unsafe.Pointer, val unsafe.Pointer) {
  56. panic("does not support unsafe operation")
  57. }
  58. func (type2 *safeType) AssignableTo(anotherType Type) bool {
  59. return type2.Type1().AssignableTo(anotherType.Type1())
  60. }