Interface Parameter<T>

    • Method Detail

      • setDefaultValue

        Parameter<T> setDefaultValue​(T defaultValue)
        Sets the default value of this parameter.
        Parameters:
        defaultValue - default value of this parameter
        Returns:
        the parameter itself, for chaining
      • hasDefaultValue

        boolean hasDefaultValue()
        Checks if this parameter has a default value.
        Returns:
        true, if this parameter has a default value, false otherwise
      • tryDefaultValue

        boolean tryDefaultValue()
                         throws UnspecifiedParameterException
        Handle default values for a parameter.
        Returns:
        Return code: true if it has a default value, false if it is optional without a default value. Exception if it is a required parameter!
        Throws:
        UnspecifiedParameterException - If the parameter requires a value
      • setOptional

        Parameter<T> setOptional​(boolean opt)
        Specifies if this parameter is an optional parameter.
        Parameters:
        opt - true if this parameter is optional, false otherwise
        Returns:
        the parameter itself, for chaining
      • isOptional

        boolean isOptional()
        Checks if this parameter is an optional parameter.
        Returns:
        true if this parameter is optional, false otherwise
      • tookDefaultValue

        boolean tookDefaultValue()
        Checks if the default value of this parameter was taken as the actual parameter value.
        Returns:
        true, if the default value was taken as actual parameter value, false otherwise
      • isDefined

        boolean isDefined()
        Returns true if the value of the option is defined, false otherwise.
        Returns:
        true if the value of the option is defined, false otherwise.
      • getDefaultValue

        T getDefaultValue()
        Returns the default value of the parameter.

        If the parameter has no default value, the method returns null.

        Returns:
        the default value of the parameter, null if the parameter has no default value.
      • getOptionID

        OptionID getOptionID()
        Return the OptionID of this option.
        Returns:
        Option ID
      • setValue

        void setValue​(java.lang.Object obj)
               throws ParameterException
        Sets the value of the option.
        Parameters:
        obj - the option's value to be set
        Throws:
        ParameterException - if the given value is not a valid value for this option.
      • isValid

        boolean isValid​(java.lang.Object obj)
                 throws ParameterException
        Checks if the given argument is valid for this option.
        Parameters:
        obj - option value to be checked
        Returns:
        true, if the given value is valid for this option
        Throws:
        ParameterException - if the given value is not a valid value for this option.
      • getSyntax

        java.lang.String getSyntax()
        Returns a string representation of the parameter's type (e.g., an IntParameter should return <int>).
        Returns:
        a string representation of the parameter's type
      • getValueAsString

        java.lang.String getValueAsString()
        Get the value as string. May return null
        Returns:
        Value as string
      • getDefaultValueAsString

        java.lang.String getDefaultValueAsString()
        Get the default value as string.
        Returns:
        default value
      • describeValues

        java.lang.StringBuilder describeValues​(java.lang.StringBuilder description)
        Describe the valid values.
        Parameters:
        description - Buffer to append to
        Returns:
        Buffer
      • addConstraint

        Parameter<T> addConstraint​(ParameterConstraint<? super T> constraint)
        Add an additional constraint.
        Parameters:
        constraint - Constraint to add.
        Returns:
        the parameter itself, for chaining
      • getConstraints

        java.util.List<ParameterConstraint<? super T>> getConstraints()
        Get the parameter constraints.
        Returns:
        Parameter constraints