Luncher91 / A2LParser

Java library to parse A2L files into an easy to use object structure.
MIT License
34 stars 13 forks source link

Override equals and hashCode methods #7

Closed ThaisMatos closed 3 years ago

ThaisMatos commented 3 years ago

Hi Andreas,

Currently it's not possible to compare two objects from the same class by its field values, since the library didn't override the equals() for its classes.

As this task requires to change a lot of files, I think it's best to discuss with you first about what do you think, before start any implementation.

If you agree with the overriding of the equals() and hashCode() methods, I can see two main approaches in order to complete this task (but of course, you can suggest a different one, if you want):

1- Use Lombok 2- Use some IDE autocompletion in each required class

Please let me know what do you think, and I'll be happy to do it! =)

Luncher91 commented 3 years ago

Hi Thais,

Thank you very much for your suggestions.

You are absolutely right about the current lack of equals and hashcode functions and I would love to see some improvement about it.

I had a look at Lombok and it looks very convenient. But if I am understanding it correctly it is necessary to have a plugin installed in the IDE to get it running. That would raise the bar for anyone who would like to participate. Is that correct?

I vote for the second solution but I would accept the Lombok variant as well. I very much appreciate any help. 👍

ThaisMatos commented 3 years ago

Hi Andreas,

Yes, the Lombok is helpful, but it requires an installed plugin. I agree with you that it will generate an extra requirement for who wants to use the library, so I also prefer the second option.

It'll be nice to help you with this. I'll do the implementation of the equals() and hashCode() methods probably next week and will submit a PR for you. =)

Thanks for your fast reply.