All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.lexicalscope.jewel.cli.OptionSpecification Maven / Gradle / Ivy

//
//Author       : t.wood
//Copyright    : (c) Teamphone.com Ltd. 2008 - All Rights Reserved
//
package com.lexicalscope.jewel.cli;

import java.util.List;

import com.lexicalscope.fluentreflection.ReflectedMethod;

/**
 * Specifies an Option
 *
 * @author t.wood
 */
interface OptionSpecification
{
    /**
     * Get a description of the option. The description can be specified in the
     * Option annotation
     *
     * @see com.lexicalscope.jewel.cli.Option
     *
     * @return a description of the option
     */
    String getDescription();

    /**
     * Each argument to this option must conform to the type returned by this
     * method
     *
     * @return the type that each argument must conform to
     */
    Class getType();

    /**
     * Canonical identifier for the option
     *
     * @return the canonical identifier for the option
     */
    String getCanonicalIdentifier();

    /**
     * Are multiple arguments allowed?
     *
     * @return True iff the the option takes multiple arguments
     */
    boolean isMultiValued();

    /**
     * Does the option have a value
     *
     * @return true iff the option has at least one value
     */
    boolean hasValue();

    /**
     * Is the argument optional
     *
     * @return is the argument optional
     */
    boolean isOptional();

    /**
     * Get the default values which will be used if the option is not specified
     * by the user.
     *
     * @return The default values which will be used if the option is not
     *         present
     */
    List getDefaultValue();

    /**
     * Is there a default value to use if this option is not present? Options
     * with a default value are assumed to be optional.
     *
     * @return true iff this option has a default value
     */
    boolean hasDefaultValue();

    /**
     * Is the option hidden from help messages?
     *
     * @return true iff the option is hidden from help messages
     */
    boolean isHidden();

    /**
     * Is the option allowed to have this many values?
     *
     * @param count the number of values that the option might have
     *
     * @return true iff the count is a valid number of values for this option
     */
    boolean allowedThisManyValues(int count);

    ReflectedMethod getMethod();

    ReflectedMethod getOptionalityMethod();

    boolean hasExactCount();

    int exactly();

    int minimum();

    int maximum();

    int maximumArgumentConsumption();

     T compareCountToSpecification(int valueCount, SpecificationMultiplicity specificationMultiplicity);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy