Skip to content

Commit

Permalink
[Improve][Api] Optimize code
Browse files Browse the repository at this point in the history
  • Loading branch information
corgy-w committed Oct 8, 2024
1 parent ce753be commit c8a46b7
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,24 @@ private void verifyRequiredOptionDuplicate(@NonNull RequiredOption requiredOptio
verifyRequiredOptionDuplicate(requiredOption, false);
}

/**
* Verifies if there are duplicate options within the required options.
*
* @param requiredOption The required option to be verified
* @param ignoreVerifyDuplicateOptions Whether to ignore duplicate option verification If
* the value is true, the existing items in OptionOptions are ignored Currently, it
* applies only to conditional
* @throws OptionValidationException If duplicate options are found
*/
private void verifyRequiredOptionDuplicate(
@NonNull RequiredOption requiredOption,
@NonNull Boolean ignoreVerifyDuplicateWithOptionOptions) {
@NonNull Boolean ignoreVerifyDuplicateOptions) {
requiredOption
.getOptions()
.forEach(
option -> {
// Check if the option is duplicate with other required options
if (!ignoreVerifyDuplicateWithOptionOptions) {
if (!ignoreVerifyDuplicateOptions) {
// Check if required option that duplicate with option options
verifyDuplicateWithOptionOptions(
option, requiredOption.getClass().getSimpleName());
}
Expand Down

0 comments on commit c8a46b7

Please sign in to comment.