ArgParserBuilderImpl.java
/*
* Copyright 2022 Terminal Utils Authors
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package net.morimekta.terminal.args.impl;
import net.morimekta.terminal.args.Arg;
import net.morimekta.terminal.args.ArgParserBuilder;
import net.morimekta.terminal.args.Option;
import java.util.List;
import java.util.Map;
/**
* Abstract base class for argument parser builders, holding common state
* for options, arguments, and name mappings.
*/
abstract class ArgParserBuilderImpl implements ArgParserBuilder {
protected ArgParserBuilderImpl(ArgParserImpl parent,
String program,
String version,
String description,
List<Option> options,
List<Arg> arguments,
Map<String, Option> longNameOptions,
Map<Character, Option> shortOptions) {
this.parent = parent;
this.program = program;
this.version = version;
this.description = description;
this.options = options;
this.arguments = arguments;
this.longNameOptions = longNameOptions;
this.shortOptions = shortOptions;
}
protected final ArgParserImpl parent;
protected final String program;
protected final String version;
protected final String description;
protected final List<Option> options;
protected final List<Arg> arguments;
protected final Map<String, Option> longNameOptions;
protected final Map<Character, Option> shortOptions;
}