
org.apache.commons.cli.PatternOptionBuilder Maven / Gradle / Ivy
/*
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 org.apache.commons.cli;
import java.io.File;
import java.io.FileInputStream;
import java.net.URL;
import java.util.Date;
/**
* Allows Options to be created from a single String. The pattern contains various single character flags and via an
* optional punctuation character, their expected type.
*
*
* Overview of PatternOptionBuilder patterns
*
* a
* -a flag
*
*
* b@
* -b [classname]
*
*
* c>
* -c [filename]
*
*
* d+
* -d [classname] (creates object via empty constructor)
*
*
* e%
* -e [number] (creates Double/Long instance depending on existing of a '.')
*
*
* f/
* -f [url]
*
*
* g:
* -g [string]
*
*
*
*
* For example, the following allows command line flags of '-v -p string-value -f /dir/file'. The exclamation mark
* precede a mandatory option.
*
*
*
* Options options = PatternOptionBuilder.parsePattern("vp:!f/");
*
*
*
* TODO These need to break out to OptionType and also to be pluggable.
*
*/
public class PatternOptionBuilder {
/** String class */
public static final Class STRING_VALUE = String.class;
/** Object class */
public static final Class
© 2015 - 2025 Weber Informatics LLC | Privacy Policy