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

Make all properties data classes #62

Merged
merged 8 commits into from
Dec 5, 2024

Conversation

ArnyminerZ
Copy link
Member

@ArnyminerZ ArnyminerZ commented Dec 3, 2024

Changes

  • Got rid of HrefListProperty$toString: should be handled by the data class.
  • Got rid of GetETag$toString: should be handled by the data class.
  • Got rid of ResourceType$toString: should be handled by the data class.
  • Moved HrefListProperty.hrefs to the constructor and made open so all the child classes can override it.
  • Improved formatting of some files.

FIXME

  • ScheduleTag has a custom toString method, do we want that implementation or use the data class one?
  • I've made all the classes use val instead of var. I think it's the best approach, since the classes shouldn't be mutable, they represent an state given by the server, and it should be kept like that. We are only modifying the values for constructing the class, and I think it's not correct to keep them as vars.
  • All HrefListProperty classes use LinkedList. Following the same principle as the point before, I think they should be immutable lists.

Signed-off-by: Arnau Mora Gras <[email protected]>
@ArnyminerZ ArnyminerZ linked an issue Dec 3, 2024 that may be closed by this pull request
@ArnyminerZ ArnyminerZ self-assigned this Dec 3, 2024
@ArnyminerZ ArnyminerZ added the refactoring Internal improvement of existing functions label Dec 3, 2024
Signed-off-by: Arnau Mora Gras <[email protected]>
Signed-off-by: Arnau Mora Gras <[email protected]>
Signed-off-by: Arnau Mora Gras <[email protected]>
@rfc2822
Copy link
Member

rfc2822 commented Dec 3, 2024

ScheduleTag has a custom toString method, do we want that implementation or use the data class one?

We can use the one from the data class.

I've made all the classes use val instead of var. I think it's the best approach, since the classes shouldn't be mutable, they represent an state given by the server, and it should be kept like that. We are only modifying the values for constructing the class, and I think it's not correct to keep them as vars. […]
All HrefListProperty classes use LinkedList. Following the same principle as the point before, I think they should be immutable lists.

Good 👍🏻

@ArnyminerZ ArnyminerZ marked this pull request as ready for review December 3, 2024 12:43
@ArnyminerZ ArnyminerZ requested a review from rfc2822 December 3, 2024 12:43
Signed-off-by: Arnau Mora Gras <[email protected]>
Signed-off-by: Arnau Mora Gras <[email protected]>
Signed-off-by: Arnau Mora Gras <[email protected]>
@ArnyminerZ ArnyminerZ requested a review from rfc2822 December 5, 2024 11:42
Signed-off-by: Arnau Mora Gras <[email protected]>
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 a4f4068 into main Dec 5, 2024
4 checks passed
@rfc2822 rfc2822 deleted the 61-make-all-properties-data-classes branch December 5, 2024 22:24
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.

Make all Properties data classes
2 participants