-
Notifications
You must be signed in to change notification settings - Fork 2
✨ add support for full address fields #244
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
src/main/java/com/mindee/parsing/standard/AddressField.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| package com.mindee.parsing.standard; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
| import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
| import com.mindee.geometry.Polygon; | ||
| import com.mindee.geometry.PolygonDeserializer; | ||
| import lombok.Getter; | ||
|
|
||
| /** | ||
| * Represent a postal address field broken down into its individual components. | ||
| */ | ||
| @Getter | ||
| @JsonIgnoreProperties(ignoreUnknown = true) | ||
| public final class AddressField extends StringField { | ||
| /** The address exactly as it appears on the document. */ | ||
| private final String rawValue; | ||
|
|
||
| /** Street number. */ | ||
| private final String streetNumber; | ||
|
|
||
| /** Street name. */ | ||
| private final String streetName; | ||
|
|
||
| /** PO-box number. */ | ||
| private final String poBox; | ||
|
|
||
| /** Additional address complement. */ | ||
| private final String addressComplement; | ||
|
|
||
| /** City or locality. */ | ||
| private final String city; | ||
|
|
||
| /** Postal or ZIP code. */ | ||
| private final String postalCode; | ||
|
|
||
| /** State, province or region. */ | ||
| private final String state; | ||
|
|
||
| /** Country. */ | ||
| private final String country; | ||
|
|
||
| public AddressField( | ||
| @JsonProperty("value") | ||
| String value, | ||
| @JsonProperty("raw_value") | ||
| String rawValue, | ||
| @JsonProperty("street_number") | ||
| String streetNumber, | ||
| @JsonProperty("street_name") | ||
| String streetName, | ||
| @JsonProperty("po_box") | ||
| String poBox, | ||
| @JsonProperty("address_complement") | ||
| String addressComplement, | ||
| @JsonProperty("city") | ||
| String city, | ||
| @JsonProperty("postal_code") | ||
| String postalCode, | ||
| @JsonProperty("state") | ||
| String state, | ||
| @JsonProperty("country") | ||
| String country, | ||
| @JsonProperty("confidence") | ||
| Double confidence, | ||
| @JsonProperty("polygon") | ||
| @JsonDeserialize(using = PolygonDeserializer.class) | ||
| Polygon polygon, | ||
| @JsonProperty("page_id") | ||
| Integer pageId | ||
| ) { | ||
| super(value, rawValue, confidence, polygon, pageId); | ||
| this.rawValue = rawValue; | ||
| this.streetNumber = streetNumber; | ||
| this.streetName = streetName; | ||
| this.poBox = poBox; | ||
| this.addressComplement = addressComplement; | ||
| this.city = city; | ||
| this.postalCode = postalCode; | ||
| this.state = state; | ||
| this.country = country; | ||
| } | ||
|
|
||
| /** | ||
| * Address field constructor only containing the value. | ||
| */ | ||
| public AddressField( | ||
| String value, | ||
| Double confidence, | ||
| Polygon polygon | ||
| ) { | ||
| this(value, null, null, null, null, | ||
| null, null, null, null, null, | ||
| confidence, polygon, null); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.