Class ParameterWrapper

java.lang.Object
org.locationtech.proj4j.geoapi.Wrapper
org.locationtech.proj4j.geoapi.ParameterWrapper
All Implemented Interfaces:
Serializable, org.opengis.metadata.Identifier, org.opengis.parameter.GeneralParameterValue, org.opengis.parameter.ParameterValue<Double>, org.opengis.referencing.ReferenceIdentifier

final class ParameterWrapper extends Wrapper implements org.opengis.parameter.ParameterValue<Double>, Serializable
Wraps a PROJ4J implementation behind the equivalent GeoAPI interface. This implementation is restricted to values of the double primitive type.
  • Field Details

    • impl

      private final Projection impl
      The wrapped PROJ4 implementation.
    • descriptor

      private final ParameterAccessor descriptor
      The parameter name together with the methods for getting or setting values.
  • Constructor Details

    • ParameterWrapper

      ParameterWrapper(Projection impl, ParameterAccessor descriptor)
      Creates a new wrapper for the given PROJ4J implementation.
      Parameters:
      impl - the wrapped PROJ4 implementation
      descriptor - methods for getting or setting values
  • Method Details

    • implementation

      Object implementation()
      Returns an arbitrary object for equality and hash code..
      Specified by:
      implementation in class Wrapper
      Returns:
      an arbitrary object for equality and hash code
    • getDescriptor

      public org.opengis.parameter.ParameterDescriptor<Double> getDescriptor()
      Returns a description of this parameter..
      Specified by:
      getDescriptor in interface org.opengis.parameter.GeneralParameterValue
      Specified by:
      getDescriptor in interface org.opengis.parameter.ParameterValue<Double>
      Returns:
      a description of this parameter
    • getCode

      public String getCode()
      Returns this parameter name, as specified in the descriptor..
      Specified by:
      getCode in interface org.opengis.metadata.Identifier
      Specified by:
      getCode in class Wrapper
      Returns:
      this parameter name, as specified in the descriptor
    • getUnit

      public javax.measure.Unit<?> getUnit()
      Returns the same unit of measurement as declared in the parameter descriptor..
      Specified by:
      getUnit in interface org.opengis.parameter.ParameterValue<Double>
      Returns:
      the same unit of measurement as declared in the parameter descriptor
    • illegalUnit

      private IllegalArgumentException illegalUnit(javax.measure.IncommensurableException e)
      Returns the exception to throw for an illegal unit of measurement..
      Returns:
      the exception to throw for an illegal unit of measurement
    • invalidReturnType

      private org.opengis.parameter.InvalidParameterTypeException invalidReturnType()
      Returns the exception to throw for all parameter types other than floating-point..
      Returns:
      the exception to throw for all parameter types other than floating-point
    • invalidParamType

      private org.opengis.parameter.InvalidParameterValueException invalidParamType(Object value)
      Returns the exception to throw for all parameter types other than floating-point..
      Returns:
      the exception to throw for all parameter types other than floating-point
    • getValue

      public Double getValue()
      Returns the value as an arbitrary object..
      Specified by:
      getValue in interface org.opengis.parameter.ParameterValue<Double>
      Returns:
      the value as an arbitrary object
    • doubleValue

      public double doubleValue()
      Returns the value in the PROJ4J projection for the parameter described by this object..
      Specified by:
      doubleValue in interface org.opengis.parameter.ParameterValue<Double>
      Returns:
      the value in the PROJ4J projection for the parameter described by this object
    • doubleValue

      public double doubleValue(javax.measure.Unit<?> unit)
      Returns the value in the PROJ4J projection for the parameter described by this object.. The value is converted to the given unit of measurement.
      Specified by:
      doubleValue in interface org.opengis.parameter.ParameterValue<Double>
      Parameters:
      unit - the unit of measurement of value to get
      Returns:
      the value in the PROJ4J projection for the parameter described by this object
      Throws:
      IllegalArgumentException - if the given unit is incompatible
    • setValue

      public void setValue(Object value) throws org.opengis.parameter.InvalidParameterValueException
      Sets the value as an arbitrary object.
      Specified by:
      setValue in interface org.opengis.parameter.ParameterValue<Double>
      Parameters:
      value - the value to set
      Throws:
      org.opengis.parameter.InvalidParameterValueException - if the value type is illegal
    • setValue

      public void setValue(double value)
      Sets the value of this parameter. Note that invoking this method may modify the PROJ4J object wrapped by OperationMethodWrapper. This is generally not recommended.
      Specified by:
      setValue in interface org.opengis.parameter.ParameterValue<Double>
      Parameters:
      value - the value to set
    • setValue

      public void setValue(double value, javax.measure.Unit<?> unit)
      Converts the given value to the unit expected by this parameter, then sets the value.
      Specified by:
      setValue in interface org.opengis.parameter.ParameterValue<Double>
      Parameters:
      value - the value to set
      unit - the unit of measurement of the given value
      Throws:
      UnsupportedOperationException - if this parameter is unmodifiable
      IllegalArgumentException - if the given unit is incompatible
    • intValue

      public int intValue()
      Specified by:
      intValue in interface org.opengis.parameter.ParameterValue<Double>
    • booleanValue

      public boolean booleanValue() throws IllegalStateException
      Specified by:
      booleanValue in interface org.opengis.parameter.ParameterValue<Double>
      Throws:
      IllegalStateException
    • stringValue

      public String stringValue() throws IllegalStateException
      Specified by:
      stringValue in interface org.opengis.parameter.ParameterValue<Double>
      Throws:
      IllegalStateException
    • valueFile

      public URI valueFile() throws IllegalStateException
      Specified by:
      valueFile in interface org.opengis.parameter.ParameterValue<Double>
      Throws:
      IllegalStateException
    • intValueList

      public int[] intValueList() throws IllegalStateException
      Specified by:
      intValueList in interface org.opengis.parameter.ParameterValue<Double>
      Throws:
      IllegalStateException
    • doubleValueList

      public double[] doubleValueList() throws IllegalStateException
      Specified by:
      doubleValueList in interface org.opengis.parameter.ParameterValue<Double>
      Throws:
      IllegalStateException
    • doubleValueList

      public double[] doubleValueList(javax.measure.Unit<?> unit) throws IllegalArgumentException, IllegalStateException
      Specified by:
      doubleValueList in interface org.opengis.parameter.ParameterValue<Double>
      Throws:
      IllegalArgumentException
      IllegalStateException
    • setValue

      public void setValue(int value) throws org.opengis.parameter.InvalidParameterValueException
      Specified by:
      setValue in interface org.opengis.parameter.ParameterValue<Double>
      Throws:
      org.opengis.parameter.InvalidParameterValueException
    • setValue

      public void setValue(boolean value) throws org.opengis.parameter.InvalidParameterValueException
      Specified by:
      setValue in interface org.opengis.parameter.ParameterValue<Double>
      Throws:
      org.opengis.parameter.InvalidParameterValueException
    • setValue

      public void setValue(double[] values, javax.measure.Unit<?> unit) throws org.opengis.parameter.InvalidParameterValueException
      Specified by:
      setValue in interface org.opengis.parameter.ParameterValue<Double>
      Throws:
      org.opengis.parameter.InvalidParameterValueException
    • clone

      public org.opengis.parameter.ParameterValue<Double> clone()
      Returns a modifiable copy of this parameter.. Note that this method is inefficient as it creates a full Projection object for each individual parameter value. It is better to invoke OperationMethodWrapper.clone() instead.
      Specified by:
      clone in interface org.opengis.parameter.GeneralParameterValue
      Specified by:
      clone in interface org.opengis.parameter.ParameterValue<Double>
      Overrides:
      clone in class Object
      Returns:
      a modifiable copy of this parameter