001/* 002 * SPDX-FileCopyrightText: none 003 * SPDX-License-Identifier: CC0-1.0 004 */ 005 006package gov.nist.secauto.metaschema.cli.processor.command; 007 008import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 009 010public class DefaultExtraArgument implements ExtraArgument { 011 private final String name; 012 private final boolean required; 013 private final int number; 014 015 @SuppressFBWarnings(value = "CT_CONSTRUCTOR_THROW", justification = "Use of final fields") 016 public DefaultExtraArgument(String name, boolean required) { 017 this(name, required, 1); 018 } 019 020 @SuppressFBWarnings(value = "CT_CONSTRUCTOR_THROW", justification = "Use of final fields") 021 public DefaultExtraArgument(String name, boolean required, int number) { 022 if (number < 1) { 023 throw new IllegalArgumentException("number must be a positive value"); 024 } 025 this.name = name; 026 this.required = required; 027 this.number = number; 028 } 029 030 @Override 031 public String getName() { 032 return name; 033 } 034 035 @Override 036 public boolean isRequired() { 037 return required; 038 } 039 040 @Override 041 public int getNumber() { 042 return number; 043 } 044 045}