-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from brenoepics/main
refactor: code cleanup
- Loading branch information
Showing
46 changed files
with
2,244 additions
and
2,258 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -33,4 +33,5 @@ replay_pid* | |
|
||
# Other | ||
|
||
client_java | ||
client_java | ||
/.idea |
This file contains 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 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 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 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 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 |
---|---|---|
|
@@ -13,19 +13,19 @@ methods: | |
### getOnlyEmail | ||
|
||
```java | ||
import io.github.multiform_validator.Utils; | ||
|
||
|
||
public class Main { | ||
public static void main(String[] args) { | ||
String msg1 = "This is a message example with [email protected] email to test"; | ||
System.out.println(Utils.getOnlyEmail(msg1, null)); // [email protected] | ||
|
||
String msg2 = "Example two [email protected] and [email protected]"; | ||
// With options | ||
Utils.GetOnlyEmailOptionsParams options = new Utils.GetOnlyEmailOptionsParams(); | ||
options.setMultiple(true); | ||
System.out.println(Utils.getOnlyEmailWithOptions(msg2, options)); // [[email protected], [email protected]] | ||
} | ||
public static void main(String[] args) { | ||
String msg1 = "This is a message example with [email protected] email to test"; | ||
System.out.println(Utils.getOnlyEmail(msg1, null)); // [email protected] | ||
|
||
String msg2 = "Example two [email protected] and [email protected]"; | ||
// With options | ||
Utils.OnlyEmailParams options = new Utils.OnlyEmailParams(); | ||
options.setMultiple(true); | ||
System.out.println(Utils.getOnlyEmailWithOptions(msg2, options)); // [[email protected], [email protected]] | ||
} | ||
} | ||
``` | ||
|
||
|
@@ -36,4 +36,4 @@ public class Main { | |
- [CreditCardValidator](https://multiform-validator.github.io/java/classes/CreditCardValidator) | ||
- [FileValidator](https://multiform-validator.github.io/java/classes/FileValidator) | ||
- [Validate](https://multiform-validator.github.io/java/classes/Validate) | ||
- [Validator](https://multiform-validator.github.io/java/classes/Validator) | ||
- [Validator](https://multiform-validator.github.io/java/classes/Validator) |
This file contains 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 |
---|---|---|
|
@@ -23,49 +23,48 @@ The `Validate` class is a utility class with some methods to validate data. It h | |
### validateEmail | ||
|
||
```java | ||
import io.github.multiform_validator.Validate; | ||
import io.github.multiform_validator.Validate.ValidateEmailOptionsParams; | ||
import io.github.multiform_validator.format.EmailValidator; | ||
|
||
import java.util.Collections; | ||
|
||
public class Main { | ||
public static void main(String[] args) { | ||
validateEmailExample(); | ||
} | ||
public static void main(String[] args) { | ||
validateEmailExample(); | ||
} | ||
|
||
public static void validateEmailExample() { | ||
// IMPORTANT: validDomains can not be used with validDomainsList, you can use only one of them | ||
public static void validateEmailExample() { | ||
// IMPORTANT: validDomains can not be used with validDomainsList, you can use only one of them | ||
|
||
// Basic email validation | ||
boolean isValid = Validate.validateEmail("[email protected]"); | ||
System.out.println("Is valid: " + isValid); // Expected: true | ||
// Basic email validation | ||
boolean isValid = EmailValidator.validateEmail("[email protected]"); | ||
System.out.println("Is valid: " + isValid); // Expected: true | ||
|
||
// Email validation with options: maxLength | ||
ValidateEmailOptionsParams optionsMaxLength = new ValidateEmailOptionsParams(); | ||
optionsMaxLength.setMaxLength(10); // Setting max length to 10, which should fail for longer emails | ||
boolean isValidMaxLength = Validate.validateEmail("[email protected]", optionsMaxLength); | ||
System.out.println("Is valid with maxLength: " + isValidMaxLength); // Expected: false | ||
// Email validation with options: maxLength | ||
EmailParams optionsMaxLength = new EmailValidator.EmailParams(); | ||
optionsMaxLength.setMaxLength(10); // Setting max length to 10, which should fail for longer emails | ||
boolean isValidMaxLength = EmailValidator.validateEmail("[email protected]", optionsMaxLength); | ||
System.out.println("Is valid with maxLength: " + isValidMaxLength); // Expected: false | ||
|
||
// Email validation with options: country specific | ||
ValidateEmailOptionsParams optionsCountry = new ValidateEmailOptionsParams(); | ||
optionsCountry.setCountry("us"); // Expecting an email from the US | ||
boolean isNotValidCountry = Validate.validateEmail("[email protected]", optionsCountry); | ||
boolean isValidCountry = Validate.validateEmail("[email protected]", optionsCountry); | ||
System.out.println("Is not valid with country: " + isNotValidCountry); // Expected: false | ||
System.out.println("Is valid with country: " + isValidCountry); // Expected: true | ||
// Email validation with options: country specific | ||
EmailParams optionsCountry = new EmailParams(); | ||
optionsCountry.setCountry("us"); // Expecting an email from the US | ||
boolean isNotValidCountry = EmailValidator.validateEmail("[email protected]", optionsCountry); | ||
boolean isValidCountry = EmailValidator.validateEmail("[email protected]", optionsCountry); | ||
System.out.println("Is not valid with country: " + isNotValidCountry); // Expected: false | ||
System.out.println("Is valid with country: " + isValidCountry); // Expected: true | ||
|
||
// Email validation with options: validDomains | ||
ValidateEmailOptionsParams optionsValidDomains = new ValidateEmailOptionsParams(); | ||
optionsValidDomains.setValidDomains(true); // Only allow certain domains (implementation specific) | ||
boolean isValidValidDomains = Validate.validateEmail("[email protected]", optionsValidDomains); | ||
System.out.println("Is valid with validDomains: " + isValidValidDomains); // Expected: true | ||
// Email validation with options: validDomains | ||
EmailParams optionsValidDomains = new EmailParams(); | ||
optionsValidDomains.setValidDomains(true); // Only allow certain domains (implementation specific) | ||
boolean isValidValidDomains = EmailValidator.validateEmail("[email protected]", optionsValidDomains); | ||
System.out.println("Is valid with validDomains: " + isValidValidDomains); // Expected: true | ||
|
||
// Email validation with options: validDomainsList | ||
ValidateEmailOptionsParams optionsValidDomainsList = new ValidateEmailOptionsParams(); | ||
optionsValidDomainsList.setValidDomainsList(Collections.singletonList("specificdomain.com")); // Adding a specific domain to the list | ||
boolean isValidValidDomainsList = Validate.validateEmail("[email protected]", optionsValidDomainsList); | ||
System.out.println("Is valid with validDomainsList: " + isValidValidDomainsList); // Expected: true | ||
} | ||
// Email validation with options: validDomainsList | ||
EmailValidator.EmailParams optionsValidDomainsList = new EmailValidator.EmailParams(); | ||
optionsValidDomainsList.setValidDomainsList(Collections.singletonList("specificdomain.com")); // Adding a specific domain to the list | ||
boolean isValidValidDomainsList = EmailValidator.validateEmail("[email protected]", optionsValidDomainsList); | ||
System.out.println("Is valid with validDomainsList: " + isValidValidDomainsList); // Expected: true | ||
} | ||
} | ||
``` | ||
|
||
|
@@ -76,4 +75,4 @@ public class Main { | |
- [CreditCardValidator](https://multiform-validator.github.io/java/classes/CreditCardValidator) | ||
- [FileValidator](https://multiform-validator.github.io/java/classes/FileValidator) | ||
- [Utils](https://multiform-validator.github.io/java/classes/Utils) | ||
- [Validator](https://multiform-validator.github.io/java/classes/Validator) | ||
- [Validator](https://multiform-validator.github.io/java/classes/Validator) |
This file contains 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.