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 PrettyTime immutable #211

Open
gastaldi opened this issue Mar 11, 2021 · 3 comments
Open

Make PrettyTime immutable #211

gastaldi opened this issue Mar 11, 2021 · 3 comments

Comments

@gastaldi
Copy link
Contributor

gastaldi commented Mar 11, 2021

In many cases, PrettyTime can be initialized only once and reused during the application's lifetime. However methods like setLocale and setReference may impact on this approach.

Therefore it would be nice if the PrettyTime object were immutable and methods that change the object's state were deprecated in favor of using it through a constructor

@gastaldi
Copy link
Contributor Author

Another solution is to return a different object when these methods are called, which I think it makes more sense

@lincolnthree
Copy link
Member

@gastaldi Hey! Thanks so much for the idea. I like it. Want to put together a PR? I still have a few things to merge in from the Java 8 update, but this would be a cool improvement. I think it would likely need to bump the major version though.

@lincolnthree
Copy link
Member

I wouldn't mind cleaning up some of the APIs at the same time, too.

gastaldi added a commit to gastaldi/prettytime that referenced this issue Apr 3, 2021
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 a pull request may close this issue.

2 participants