addReflectionAccessors scans struct fields and adds them as accessors Only exported fields are processed to maintain Go encapsulation principles
(builder *ClassBuilder, typ reflect.Type, opts *ReflectOptions)
| 270 | // addReflectionAccessors scans struct fields and adds them as accessors |
| 271 | // Only exported fields are processed to maintain Go encapsulation principles |
| 272 | func addReflectionAccessors(builder *ClassBuilder, typ reflect.Type, opts *ReflectOptions) { |
| 273 | for i := 0; i < typ.NumField(); i++ { |
| 274 | field := typ.Field(i) |
| 275 | |
| 276 | if shouldSkipField(field, opts) { |
| 277 | continue |
| 278 | } |
| 279 | |
| 280 | // Use unified tag parsing from marshal.go |
| 281 | tagInfo := parseFieldTag(field) |
| 282 | if tagInfo.Skip { |
| 283 | continue // Field marked with "-" tag |
| 284 | } |
| 285 | |
| 286 | // Create getter and setter functions |
| 287 | getter := createFieldGetter(field, i) |
| 288 | setter := createFieldSetter(field, i) |
| 289 | |
| 290 | // Add accessor to builder (instance accessors by default) |
| 291 | builder.Accessor(tagInfo.Name, getter, setter) |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | // ============================================================================= |
| 296 | // OPTIMIZED HELPER FUNCTIONS |
no test coverage detected