Skip to content

Commit

Permalink
add license and missing javadoc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Machine-Maker committed Jan 6, 2022
1 parent d400b2a commit 35d1ec8
Showing 1 changed file with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
//
// MIT License
//
// Copyright (c) 2021 Alexander Söderberg & Contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
package cloud.commandframework.arguments.standard;

import cloud.commandframework.ArgumentDescription;
Expand Down Expand Up @@ -302,6 +325,12 @@ public static final class PseudoEnumParser<C> implements ArgumentParser<C, Strin
private final Set<String> allowedValues;
private final StringArgument.StringParser<C> stringParser;

/**
* Parser for pseudo-enums
*
* @param stringMode Mode to capture strings
* @param allowedValues Allowed values
*/
public PseudoEnumParser(
final StringArgument.@NonNull StringMode stringMode,
final @NonNull Set<String> allowedValues
Expand All @@ -320,7 +349,7 @@ public PseudoEnumParser(
return result;
} else if (result.getParsedValue().isPresent()) {
String input = result.getParsedValue().get();
if (!allowedValues.contains(input)) {
if (!this.allowedValues.contains(input)) {
return ArgumentParseResult.failure(new PseudoEnumParseException(input, this.allowedValues, commandContext));
} else {
return result;
Expand Down

0 comments on commit 35d1ec8

Please sign in to comment.