MCPcopy Create free account
hub / github.com/apache/fory / has

Method has

go/fory/optional_serializer.go:146–160  ·  view source on GitHub ↗
(value reflect.Value)

Source from the content-addressed store, hash-verified

144}
145
146func (s *optionalSerializer) has(value reflect.Value) bool {
147 value = s.unwrap(value)
148 if !value.IsValid() {
149 return false
150 }
151 if value.CanAddr() {
152 hasPtr := (*bool)(unsafe.Add(unsafe.Pointer(value.UnsafeAddr()), s.hasOffset))
153 return *hasPtr
154 }
155 field := value.FieldByName("has")
156 if !field.IsValid() {
157 return false
158 }
159 return field.Bool()
160}
161
162func (s *optionalSerializer) valueField(value reflect.Value) reflect.Value {
163 value = s.unwrap(value)

Callers 10

WriteMethod · 0.95
addFieldFunction · 0.80
registerSerializerMethod · 0.80
shouldSkipCompatibleReadFunction · 0.80
checkExistsMethod · 0.80
addDeclarMethod · 0.80
fromTypeInfoMethod · 0.80
remapFieldNamesMethod · 0.80

Calls 3

unwrapMethod · 0.95
BoolMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected