1 /*
2 * SPDX-FileCopyrightText: none
3 * SPDX-License-Identifier: CC0-1.0
4 */
5
6 package gov.nist.secauto.metaschema.cli.processor.command.impl;
7
8 import gov.nist.secauto.metaschema.cli.processor.command.ExtraArgument;
9
10 import edu.umd.cs.findbugs.annotations.NonNull;
11
12 /**
13 * A default implementation of the {@link ExtraArgument} interface that
14 * represents a named command-line argument which can be marked as required or
15 * optional.
16 * <p>
17 * This implementation is used by the command processor to handle additional
18 * arguments that are not covered by specific command options.
19 */
20 public class DefaultExtraArgument implements ExtraArgument {
21 private final String name;
22 private final boolean required;
23
24 /**
25 * Construct a new instance.
26 *
27 * @param name
28 * the argument name
29 * @param required
30 * {@code true} if the argument is required, or {@code false} otherwise
31 */
32 public DefaultExtraArgument(@NonNull String name, boolean required) {
33 this.name = name;
34 this.required = required;
35 }
36
37 @Override
38 public String getName() {
39 return name;
40 }
41
42 @Override
43 public boolean isRequired() {
44 return required;
45 }
46 }