Class DefaultParameterDescriptor<T>

    • Constructor Detail

      • DefaultParameterDescriptor

        public DefaultParameterDescriptor​(ParameterDescriptor<T> descriptor)
        Constructs a descriptor with the same values than the specified one. This copy constructor may be used in order to wraps an arbitrary implementation into a Geotools one.
        Parameters:
        descriptor - The descriptor to copy.
        Since:
        2.2
      • DefaultParameterDescriptor

        public DefaultParameterDescriptor​(String name,
                                          Class<T> valueClass,
                                          T[] validValues,
                                          T defaultValue)
        Constructs a mandatory parameter for a set of predefined values.
        Parameters:
        name - The parameter name.
        valueClass - The class that describe the type of the parameter.
        validValues - A finite set of valid values (usually from a {linkplain org.geotools.api.util.CodeList code list}) or null if it doesn't apply.
        defaultValue - The default value for the parameter, or null.
      • DefaultParameterDescriptor

        public DefaultParameterDescriptor​(Citation authority,
                                          String name,
                                          Class<T> valueClass,
                                          T[] validValues,
                                          T defaultValue,
                                          Comparable<T> minimum,
                                          Comparable<T> maximum,
                                          Unit<?> unit,
                                          boolean required)
        Constructs a parameter from an authority and a name.
        Parameters:
        authority - The authority (e.g. OGC).
        name - The parameter name.
        valueClass - The class that describe the type of the parameter.
        validValues - A finite set of valid values (usually from a {linkplain org.geotools.api.util.CodeList code list}) or null if it doesn't apply.
        defaultValue - The default value for the parameter, or null.
        minimum - The minimum parameter value, or null.
        maximum - The maximum parameter value, or null.
        unit - The unit for default, minimum and maximum values.
        required - true if this parameter is required, or false if it is optional.
        Since:
        2.2
      • DefaultParameterDescriptor

        public DefaultParameterDescriptor​(Map<String,​?> properties,
                                          Class<T> valueClass,
                                          T[] validValues,
                                          T defaultValue,
                                          Comparable<T> minimum,
                                          Comparable<T> maximum,
                                          Unit<?> unit,
                                          boolean required)
        Constructs a parameter from a set of properties. The properties map is given unchanged to the super-class constructor.
        Parameters:
        properties - Set of properties. Should contains at least "name".
        valueClass - The class that describe the type of the parameter.
        validValues - A finite set of valid values (usually from a {linkplain org.geotools.api.util.CodeList code list}) or null if it doesn't apply.
        defaultValue - The default value for the parameter, or null.
        minimum - The minimum parameter value, or null.
        maximum - The maximum parameter value, or null.
        unit - The unit for default, minimum and maximum values.
        required - true if this parameter is required, or false if it is optional.
    • Method Detail

      • create

        public static DefaultParameterDescriptor<Integer> create​(String name,
                                                                 int defaultValue,
                                                                 int minimum,
                                                                 int maximum)
        Constructs a descriptor for a mandatory parameter in a range of integer values.
        Parameters:
        name - The parameter name.
        defaultValue - The default value for the parameter.
        minimum - The minimum parameter value, or Integer.MIN_VALUE if none.
        maximum - The maximum parameter value, or Integer.MAX_VALUE if none.
        Returns:
        The parameter descriptor for the given range of values.
        Since:
        2.5
      • create

        public static DefaultParameterDescriptor<Integer> create​(Map<String,​?> properties,
                                                                 int defaultValue,
                                                                 int minimum,
                                                                 int maximum,
                                                                 boolean required)
        Constructs a descriptor for a parameter in a range of integer values.
        Parameters:
        properties - The parameter properties (name, identifiers, alias...).
        defaultValue - The default value for the parameter.
        minimum - The minimum parameter value, or Integer.MIN_VALUE if none.
        maximum - The maximum parameter value, or Integer.MAX_VALUE if none.
        required - true if this parameter is required, false otherwise.
        Returns:
        The parameter descriptor for the given range of values.
        Since:
        2.5
      • create

        public static DefaultParameterDescriptor<Double> create​(String name,
                                                                double defaultValue,
                                                                double minimum,
                                                                double maximum,
                                                                Unit<?> unit)
        Constructs a descriptor for a mandatory parameter in a range of floating point values.
        Parameters:
        name - The parameter name.
        defaultValue - The default value for the parameter, or Double.NaN if none.
        minimum - The minimum parameter value, or Double.NEGATIVE_INFINITY if none.
        maximum - The maximum parameter value, or Double.POSITIVE_INFINITY if none.
        unit - The unit for default, minimum and maximum values.
        Returns:
        The parameter descriptor for the given range of values.
        Since:
        2.5
      • create

        public static DefaultParameterDescriptor<Double> create​(Map<String,​?> properties,
                                                                double defaultValue,
                                                                double minimum,
                                                                double maximum,
                                                                Unit<?> unit,
                                                                boolean required)
        Constructs a descriptor for a parameter in a range of floating point values.
        Parameters:
        properties - The parameter properties (name, identifiers, alias...).
        defaultValue - The default value for the parameter, or Double.NaN if none.
        minimum - The minimum parameter value, or Double.NEGATIVE_INFINITY if none.
        maximum - The maximum parameter value, or Double.POSITIVE_INFINITY if none.
        unit - The unit of measurement for default, minimum and maximum values.
        required - true if this parameter is required, false otherwise.
        Returns:
        The parameter descriptor for the given range of values.
        Since:
        2.5
      • create

        public static <T> DefaultParameterDescriptor<T> create​(String name,
                                                               CharSequence remarks,
                                                               Class<T> valueClass,
                                                               T defaultValue,
                                                               boolean required)
        Constructs a descriptor from a name and a default value.
        Type Parameters:
        T - The parameter type.
        Parameters:
        name - The parameter name.
        remarks - An optional description as a String or an InternationalString.
        valueClass - The parameter type.
        defaultValue - The default value.
        required - true if this parameter is required, false otherwise.
        Returns:
        The parameter descriptor for the given default value.
        Since:
        2.5
      • getValueClass

        public Class<T> getValueClass()
        Returns the class that describe the type of the parameter.
        Specified by:
        getValueClass in interface ParameterDescriptor<T>
        Returns:
        The parameter value class.
      • getValidValues

        public Set<T> getValidValues()
        If this parameter allows only a finite set of values, returns this set. This set is usually a {linkplain org.geotools.api.util.CodeList code list} or enumerations. This method returns null if this parameter doesn't limits values to a finite set.
        Specified by:
        getValidValues in interface ParameterDescriptor<T>
        Returns:
        A finite set of valid values (usually from a {linkplain org.geotools.api.util.CodeList code list}), or null if it doesn't apply.
      • getDefaultValue

        public T getDefaultValue()
        Returns the default value for the parameter. The return type can be any type including a Number or a String. If there is no default value, then this method returns null.
        Specified by:
        getDefaultValue in interface ParameterDescriptor<T>
        Returns:
        The default value, or null in none.
      • getMinimumValue

        public Comparable<T> getMinimumValue()
        Returns the minimum parameter value. If there is no minimum value, or if minimum value is inappropriate for the parameter type, then this method returns null.
        Specified by:
        getMinimumValue in interface ParameterDescriptor<T>
        Returns:
        The minimum parameter value (often an instance of Double), or null.
      • getMaximumValue

        public Comparable<T> getMaximumValue()
        Returns the maximum parameter value. If there is no maximum value, or if maximum value is inappropriate for the parameter type, then this method returns null.
        Specified by:
        getMaximumValue in interface ParameterDescriptor<T>
        Returns:
        The minimum parameter value (often an instance of Double), or null.
      • getUnit

        public Unit<?> getUnit()
        Returns the unit for default, minimum and maximum values. This attribute apply only if the values is of numeric type (usually an instance of Double).
        Specified by:
        getUnit in interface ParameterDescriptor<T>
        Returns:
        The unit for numeric value, or null if it doesn't apply to the value type.
      • equals

        public boolean equals​(AbstractIdentifiedObject object,
                              boolean compareMetadata)
        Compares the specified object with this parameter for equality.
        Overrides:
        equals in class AbstractParameterDescriptor
        Parameters:
        object - The object to compare to this.
        compareMetadata - true for performing a strict comparaison, or false for comparing only properties relevant to transformations.
        Returns:
        true if both objects are equal.
      • hashCode

        public int hashCode()
        Returns a hash value for this parameter.
        Overrides:
        hashCode in class AbstractParameterDescriptor
        Returns:
        The hash code value. This value doesn't need to be the same in past or future versions of this class.