Class ContextualParameter<T>

java.lang.Object
org.apache.sis.io.wkt.FormattableObject
org.apache.sis.parameter.DefaultParameterValue<T>
org.apache.sis.referencing.operation.transform.ContextualParameter<T>
Type Parameters:
T - the type of the value stored in this parameter.
All Implemented Interfaces:
Serializable, Cloneable, LenientComparable, org.opengis.parameter.GeneralParameterValue, org.opengis.parameter.ParameterValue<T>

final class ContextualParameter<T> extends DefaultParameterValue<T>
A parameter value stored in ContextualParameters before they are made unmodifiable. This temporary ParameterValue bypasses the validity check normally performed by DefaultParameterValue.
Rational: The intent is to skip the parameter value verification done by DefaultParameterValue.setValue(Object, Unit) on the assumption that the value has already been verified when the user created his ParameterValueGroup. Even if the user's ParameterValue implementation did not performed any verification, there is chances that DefaultMathTransformFactory copied the parameters in instances of the org.apache.sis.parameter package that do the checks.

Skipping redundant verifications allows us to avoid redundant logging messages when the Semaphores.SUSPEND_PARAMETER_CHECK flag is set. Furthermore, it is a little bit late for checking parameter validity here; that verification should have been done at AbstractMathTransform construction time or even before, and the job of the ContextualParameters class is just to record what have been used.

Note that the ContextualParameters.freeze() method will replace all ParameterValue instances by UnmodifiableParameterValue instances anyway. So no matter which temporary instance we used, we will end with the same objects in memory anyway.
Since:
0.7
Version:
0.7
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      For cross-version compatibility.
      See Also:
  • Constructor Details

    • ContextualParameter

      ContextualParameter(org.opengis.parameter.ParameterDescriptor<T> descriptor)
      Creates a parameter value from the specified descriptor. The value will be initialized to the default value, if any.
      Parameters:
      descriptor - the abstract definition of this parameter.
  • Method Details

    • setValue

      protected void setValue(Object value, javax.measure.Unit<?> unit)
      Sets the parameter value and its associated unit without any verification of parameter validity (except value type).
      Overrides:
      setValue in class DefaultParameterValue<T>
      Parameters:
      value - the parameter value, or null to restore the default.
      unit - the unit associated to the new parameter value, or null.
      See Also: