Skip to content

Conversation

@pditommaso
Copy link
Collaborator

@pditommaso pditommaso commented Oct 19, 2025

Summary

Refactored MoshiEncodeStrategy to remove Wave-specific internal class dependencies by extracting polymorphic type adapter configurations into dedicated strategy factory classes. This improves separation of concerns and makes MoshiEncodeStrategy a more generic, reusable component.

Changes

Structural Improvements

  • Removed hardcoded Wave classes from MoshiEncodeStrategy: Extracted DigestStore and PairingMessage polymorphic adapter configurations from the core MoshiEncodeStrategy class
  • Created dedicated factory classes:
    • PairingMessageEncodeStrategy: Manages polymorphic adapters for pairing message types (ProxyHttpRequest, ProxyHttpResponse, PairingHeartbeat, PairingResponse)
    • DigestStoreEncodeStrategy: Manages polymorphic adapters for digest store types (ZippedDigestStore, HttpDigestStore, DockerDigestStore)

Updated Consumers

  • PairingInboundStore: Now uses PairingMessageEncodeStrategy.create()
  • PairingOutboundQueue: Implements createEncodingStrategy() using PairingMessageEncodeStrategy
  • ManifestCacheStore: Now uses DigestStoreEncodeStrategy.create()

Test Organization

  • Created PairingMessageMoshiTypeAdapterTest for pairing message encoding tests
  • Created DigestStoreEncodeStrategyTest for digest store encoding tests
  • Removed redundant tests from MoshiEncodingStrategyTest

Benefits

  1. Better Separation of Concerns: MoshiEncodeStrategy is no longer coupled to Wave-specific domain classes
  2. Improved Reusability: Core encoding strategy can now be used without Wave-specific dependencies
  3. Clearer Documentation: Each factory class documents its supported types with comprehensive Javadoc
  4. Better Maintainability: Type adapter configurations are centralized and easier to update

🤖 Generated with Claude Code

Added detailed Javadoc documentation to PairingMessageEncodeStrategy
and DigestStoreEncodeStrategy classes explaining their purpose as
factory classes for creating Moshi-based encoding strategies with
polymorphic JSON adapter support.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@pditommaso pditommaso changed the title Add comprehensive Javadoc to encoding strategy classes Refactor MoshiEncodeStrategy to remove Wave-specific polymorphic type adapters Oct 19, 2025
Signed-off-by: Paolo Di Tommaso <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
@pditommaso pditommaso marked this pull request as ready for review October 23, 2025 07:59
Signed-off-by: Paolo Di Tommaso <[email protected]>
@pditommaso pditommaso merged commit abc7128 into master Oct 23, 2025
@pditommaso pditommaso deleted the cache-refactor branch October 23, 2025 11:33
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.

2 participants