Skip to content

Conversation

Sotatek-DucPhung
Copy link
Collaborator

@Sotatek-DucPhung Sotatek-DucPhung commented Sep 5, 2025

Refactoring Summary: Removing Object Usage #47

🎯 Key Objectives

  • Replace Object with specific types for better type safety
  • Eliminate error-prone type casting and runtime checks
  • Improve code clarity and documentation

🏗️ Architecture Changes

  • Created Sith Interface Hierarchy
    • IntegerSith: For numeric thresholds
    • StringSith: For string-based thresholds
    • WeightedSith: For weighted threshold lists
  • Implemented Visitor Pattern
    • Type-safe operations across different implementations
    • Clean double dispatch mechanism

🔧 Technical Improvements

  • Refactored Tholder Class
    • Type-specific overloaded methods
    • Specialized constructors
    • Fixed type erasure issues with collections
  • Enhanced Factory Methods
    • Comprehensive fromObject() conversion
    • Type-specific creation methods
    • Robust error handling

🔄 API Updates

  • Modified Parameter Types
    • CreateIdentifierArgs: Object isith/nsithSith isith/nsith
    • RotateIdentifierArgs: Object nsithSith nsith
  • Updated Method Signatures
    • Tholder.getSith(): ObjectSith
    • Added getOriginalSith() for backward compatibility

…ot found cases

- Changed methods in multiple classes to return Optional for identifier retrieval, improving null safety.
- Updated exception handling to throw IllegalArgumentException when identifiers are not found.
- Adjusted related test cases to accommodate the new Optional return type.
…tiple classes

- Updated CreateIdentifierArgs, RotateIdentifierArgs, and related classes to use Sith type instead of Object for isith and nsith fields.
- Refactored Identifier and Tholder classes to handle Sith type for signing thresholds.
- Enhanced Eventing and Controller classes to utilize Sith for improved type safety.
- Added new Sith class to encapsulate signing threshold logic and provide various constructors for different threshold types.
- Updated tests to validate the new Sith implementations and ensure correct functionality.
@Sotatek-DucPhung Sotatek-DucPhung marked this pull request as draft September 5, 2025 18:07
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