Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AwsUtils] Refactor AwsEventWrapperFactory's APIs #15

Closed
binchoo opened this issue Jul 8, 2022 · 0 comments
Closed

[AwsUtils] Refactor AwsEventWrapperFactory's APIs #15

binchoo opened this issue Jul 8, 2022 · 0 comments
Assignees
Milestone

Comments

@binchoo
Copy link
Owner

binchoo commented Jul 8, 2022

As-is:

  1. AwsEventWrapperFactory depends on EventWrapperMapping instance.
  2. Its behaviors are changed by the AwsEventWrapperFactoryConfigurer instance that configures an EventWrapperMapping instance.
  3. This means AwsEventWrapperFactory relies on dynamic dependencies. However it has two static factory methods, one of which creates a AwsEventWrapper, the other creates a customized AwsEventWrapperFactory. This is why it has a strange interface for creating customized instances.
var eventWapper = AwsEventWrapperFactory.getWrapper(snsEvent);
var customFactory = AwsEventWrapperFactory.create(configurer);
var eventWrapper2 = customFactory.getWrapper(snsEvent);
  • Line 1 and 3 create AwsEventWrappers.
  • Besides, Line 2 creates AwsEventWrapperFactory.
  • This is not a comprehensive interface.

To-be:

  1. Add a static factory method to create the default AwsEventWrapperFactory instance: getDefault().
  2. Add a static factory method to create custom AwsEventWrapperFactory instances: newInstance().
  3. Add a private constructor: AwsEventWrapperFactory(AwsEventWrapperFactoryConfigurer).
  4. Remove the static getWrapper() method. Make it non-static.
@binchoo binchoo added this to the release 1.0.3 milestone Jul 8, 2022
@binchoo binchoo self-assigned this Jul 8, 2022
@binchoo binchoo closed this as completed Jul 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant