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

Create new class ParseWithOptions #3730

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

KarolJakubKrawiec
Copy link

Created a new class called ParseWithOptions that should allow for easier use of different methods such as keepRawInput or defaultRegion.

@KarolJakubKrawiec KarolJakubKrawiec requested a review from a team as a code owner November 27, 2024 13:04
@silvio2402 silvio2402 self-requested a review November 27, 2024 13:06
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.
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.
Copy link
Collaborator

@silvio2402 silvio2402 left a 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.
Copy link
Collaborator

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."?

Comment on lines 21 to 27
/**
* 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.
*/

Copy link
Collaborator

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?

Comment on lines +38 to +41
/**
* 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.
*/
Copy link
Collaborator

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
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 this pull request may close these issues.

2 participants