-
Notifications
You must be signed in to change notification settings - Fork 0
Language Tag class #6
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
Conversation
* @param languageCode RFC 5646 Language Tag | ||
*/ | ||
public void remove(String languageCode) { | ||
public void remove(LangTag languageCode) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i wanted string overloads for everything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So have both (in this case) remove(String str)
and remove(LangTag langTag)
? And if that's so shouldn't the same be applied to the Extensions
class with URIs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes have both. And yeah extensions would be nice too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note how in addition to adding the overloaded methods for both LangMaps and extensions, I also added the IFreeMap interface so that we can:
- enforce the contract of needing not just
get
,put
, andremove
, but overloaded variants of each - have a single FreeMapSerializer instead of two separate serializers
@JsonCreator | ||
public LangTag(String langTagStr) throws IllformedLocaleException { | ||
Builder builder = new Builder(); | ||
languageTagLocale = builder.setLanguageTag(langTagStr).build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's a static helper for this. Builder doesnt even need to be imported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah now I know why I used the Builder class instead of forLanguageTag. The former throws an exception on invalid language tags; the latter doesn't, and that is why CI is failing now.
MIME Type and Version Strings
Implement a
LangTag
class that wraps the original language tag string and ajava.util.Locale
instance. Use it asLangMap
keys and for thecontext.language
property.