-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Create new class ParseWithOptions #3730
base: master
Are you sure you want to change the base?
Create new class ParseWithOptions #3730
Conversation
a09decd
to
251e95e
Compare
I have added the new parsing methode ParsingOptions to the OpenSource version.
There is a new class called PrasingOptions. With it we can replace old parsing methodes such as keepRawInput or defaultRegion.
I have added the new parsing methode ParsingOptions to the OpenSource version.
There is a new class called PrasingOptions. With it we can replace old parsing methodes such as keepRawInput or defaultRegion.
251e95e
to
45cb5e4
Compare
We had to switch up the deprecated test cases of parseAndKeepRawInput and replaced them with parseWithOptions. It includes the phonenumber that has to be parsed and the options such as if the raw input should be kept or what the default regioncode is.
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.
Good! Please also merge the changes from the base branch.
@@ -2085,7 +2085,7 @@ public void testMaybeExtractCountryCode() { | |||
public void testParseNationalNumber() throws Exception { | |||
// National prefix attached. | |||
assertEquals(NZ_NUMBER, phoneUtil.parse("033316005", RegionCode.NZ)); | |||
// Some fields are not filled in by parse, but only by parseAndKeepRawInput. | |||
// Some fields are not filled in by parse, but only by parseWithOptions. |
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.
Can you add " with the keepRawInput option set."?
/** | ||
* Returns the region we are expecting the number to be from. This is ignored if the number being | ||
* parsed is written in international format. In case of national format, the country_code will be | ||
* set to the one of this default region. If the number is guaranteed to start with a '+' followed | ||
* by the country calling code, then RegionCode.ZZ or null can be supplied. | ||
*/ | ||
|
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.
Can you move the javadoc above getDefaultRegion
?
/** | ||
* Returns whether the raw input should be kept in the PhoneNumber object. If true, the raw_input | ||
* field and country_code_source fields will be populated. | ||
*/ |
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.
See comment above.
I rewrote some comments because they didnt make sense and were misplaced
In this commit we added the ParsingOptions from the java version which will make parsing in different ways easier
Created a new class called ParseWithOptions that should allow for easier use of different methods such as keepRawInput or defaultRegion.