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

Use StringDef to annotate possible service and collection types #1227

Conversation

sunkup
Copy link
Member

@sunkup sunkup commented Jan 9, 2025

Purpose

By adding the @StringDef annotation, we make the code more robust and easier to maintain.

  • Type Safety: It prevents us from accidentally passing invalid string values to the type properties, which can help catch errors at compile time.
  • Code Clarity: It makes the code more readable and self-documenting by clearly defining the allowed values for the respective type properties.
  • Code Completion: When using the type properties, Android Studio will provide code completion suggestions for the allowed values, which can improve our development speed.

Short description

  • define annotation classes "CollectionType" and "ServiceType" with respective possible values in StringDef
  • add the annotations to the two type params respectively

Checklist

  • The PR has a proper title, description and label.
  • I have self-reviewed the PR.
  • I have added documentation to complex functions and functions that can be used by other modules.
  • I have added reasonable tests or consciously decided to not add tests.

@sunkup sunkup added the refactoring Internal improvement of existing functions label Jan 9, 2025
@sunkup sunkup self-assigned this Jan 9, 2025
@sunkup sunkup linked an issue Jan 9, 2025 that may be closed by this pull request
@sunkup sunkup requested a review from ArnyminerZ January 9, 2025 10:00
@sunkup sunkup marked this pull request as ready for review January 9, 2025 10:00
Copy link
Member

@ArnyminerZ ArnyminerZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@sunkup sunkup requested a review from rfc2822 January 9, 2025 10:21
Copy link
Member

@rfc2822 rfc2822 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍🏻

@rfc2822 rfc2822 merged commit 843013a into main-ose Jan 9, 2025
12 checks passed
@rfc2822 rfc2822 deleted the 1225-db-use-stringdef-to-annotate-possible-service-and-collection-types branch January 9, 2025 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Internal improvement of existing functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DB: use @StringDef to annotate possible service and collection types
3 participants