Skip to content

refactor(generator): factory method classes — IOFactory, IODispatcher, ClonerFactory (C32d Step 2d)#1132

Merged
jsenko merged 1 commit into
mainfrom
factory-method-classes
Jun 29, 2026
Merged

refactor(generator): factory method classes — IOFactory, IODispatcher, ClonerFactory (C32d Step 2d)#1132
jsenko merged 1 commit into
mainfrom
factory-method-classes

Conversation

@jsenko

@jsenko jsenko commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

3 new method classes for factory stage logic (parameterized to avoid 6 separate classes):

Method Class Mode Generates
IOFactoryMethod READER/WRITER createModelReader/Writer(ModelType) switch
IODispatcherFactoryMethod READER/WRITER createModelReader/WriterDispatcher(ModelType, ObjectNode) switch
ClonerFactoryMethod createModelCloner(ModelType) with unique dispatcher construction

Factory stages are now thin wrappers. Net -144 lines.

Smart observation by the agent: reader/writer factories are structurally identical (just class name substitution), so a single parameterized IOFactoryMethod with Mode.READER/Mode.WRITER handles both. Cloner has a unique pattern (nested dispatcher construction), so it gets its own class.

Context

C32d Step 2d in #1042. Completes the method class extraction — every generated method now has a corresponding method class.

Test plan

  • All 1129 data-models tests pass
  • Generated output unchanged

…, ClonerFactory (C32d Step 2d)

3 new method classes (parameterized instead of 6 separate):
- IOFactoryMethod (Reader/Writer mode) — createModelReader/Writer switch
- IODispatcherFactoryMethod (Reader/Writer mode) — dispatcher switch
- ClonerFactoryMethod — createModelCloner with unique dispatcher pattern

Factory stages now thin wrappers delegating to method classes.
Added 5 FQN methods to CodeGenContext.

Net -144 lines.
@jsenko jsenko merged commit 4429fdd into main Jun 29, 2026
2 checks passed
@jsenko jsenko deleted the factory-method-classes branch June 29, 2026 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant