Class ParameterWrapper

  • All Implemented Interfaces:
    java.io.Serializable, org.opengis.metadata.Identifier, org.opengis.parameter.GeneralParameterValue, org.opengis.parameter.ParameterValue<java.lang.Double>, org.opengis.referencing.ReferenceIdentifier

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

      Fields 
      Modifier and Type Field Description
      private ParameterAccessor descriptor
      The parameter name together with the methods for getting or setting values.
      private Projection impl
      The wrapped PROJ4 implementation.
      • Fields inherited from interface org.opengis.metadata.Identifier

        AUTHORITY_KEY, CODE_KEY
      • Fields inherited from interface org.opengis.referencing.ReferenceIdentifier

        CODESPACE_KEY, VERSION_KEY
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean booleanValue()  
      org.opengis.parameter.ParameterValue<java.lang.Double> clone()
      {@return a modifiable copy of this parameter}.
      double doubleValue()
      {@return the value in the PROJ4J projection for the parameter described by this object}.
      double doubleValue​(javax.measure.Unit<?> unit)
      {@return the value in the PROJ4J projection for the parameter described by this object}.
      double[] doubleValueList()  
      double[] doubleValueList​(javax.measure.Unit<?> unit)  
      java.lang.String getCode()
      {@return this parameter name, as specified in the descriptor}.
      org.opengis.parameter.ParameterDescriptor<java.lang.Double> getDescriptor()
      {@return a description of this parameter}.
      javax.measure.Unit<?> getUnit()
      {@return the same unit of measurement as declared in the parameter descriptor}.
      java.lang.Double getValue()
      {@return the value as an arbitrary object}.
      private java.lang.IllegalArgumentException illegalUnit​(javax.measure.IncommensurableException e)
      {@return the exception to throw for an illegal unit of measurement}.
      (package private) java.lang.Object implementation()
      {@return an arbitrary object for equality and hash code}.
      int intValue()  
      int[] intValueList()  
      private org.opengis.parameter.InvalidParameterValueException invalidParamType​(java.lang.Object value)
      {@return the exception to throw for all parameter types other than floating-point}.
      private org.opengis.parameter.InvalidParameterTypeException invalidReturnType()
      {@return the exception to throw for all parameter types other than floating-point}.
      void setValue​(boolean value)  
      void setValue​(double value)
      Sets the value of this parameter.
      void setValue​(double[] values, javax.measure.Unit<?> unit)  
      void setValue​(double value, javax.measure.Unit<?> unit)
      Converts the given value to the unit expected by this parameter, then sets the value.
      void setValue​(int value)  
      void setValue​(java.lang.Object value)
      Sets the value as an arbitrary object.
      java.lang.String stringValue()  
      java.net.URI valueFile()  
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • 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 Detail

      • 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 Detail

      • implementation

        java.lang.Object implementation()
        {@return an arbitrary object for equality and hash code}.
        Specified by:
        implementation in class Wrapper
      • getDescriptor

        public org.opengis.parameter.ParameterDescriptor<java.lang.Double> getDescriptor()
        {@return a description of this parameter}.
        Specified by:
        getDescriptor in interface org.opengis.parameter.GeneralParameterValue
        Specified by:
        getDescriptor in interface org.opengis.parameter.ParameterValue<java.lang.Double>
      • getCode

        public java.lang.String getCode()
        {@return this parameter name, as specified in the descriptor}.
        Specified by:
        getCode in interface org.opengis.metadata.Identifier
        Specified by:
        getCode in class Wrapper
      • getUnit

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

        private java.lang.IllegalArgumentException illegalUnit​(javax.measure.IncommensurableException e)
        {@return the exception to throw for an illegal unit of measurement}.
      • invalidReturnType

        private org.opengis.parameter.InvalidParameterTypeException invalidReturnType()
        {@return the exception to throw for all parameter types other than floating-point}.
      • invalidParamType

        private org.opengis.parameter.InvalidParameterValueException invalidParamType​(java.lang.Object value)
        {@return the exception to throw for all parameter types other than floating-point}.
      • getValue

        public java.lang.Double getValue()
        {@return the value as an arbitrary object}.
        Specified by:
        getValue in interface org.opengis.parameter.ParameterValue<java.lang.Double>
      • doubleValue

        public double doubleValue()
        {@return the value in the PROJ4J projection for the parameter described by this object}.
        Specified by:
        doubleValue in interface org.opengis.parameter.ParameterValue<java.lang.Double>
      • doubleValue

        public double doubleValue​(javax.measure.Unit<?> unit)
        {@return 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<java.lang.Double>
        Parameters:
        unit - the unit of measurement of value to get
        Throws:
        java.lang.IllegalArgumentException - if the given unit is incompatible
      • setValue

        public void setValue​(java.lang.Object value)
                      throws org.opengis.parameter.InvalidParameterValueException
        Sets the value as an arbitrary object.
        Specified by:
        setValue in interface org.opengis.parameter.ParameterValue<java.lang.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<java.lang.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<java.lang.Double>
        Parameters:
        value - the value to set
        unit - the unit of measurement of the given value
        Throws:
        java.lang.UnsupportedOperationException - if this parameter is unmodifiable
        java.lang.IllegalArgumentException - if the given unit is incompatible
      • intValue

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

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

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

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

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

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

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

        public void setValue​(int value)
                      throws org.opengis.parameter.InvalidParameterValueException
        Specified by:
        setValue in interface org.opengis.parameter.ParameterValue<java.lang.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<java.lang.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<java.lang.Double>
        Throws:
        org.opengis.parameter.InvalidParameterValueException
      • clone

        public org.opengis.parameter.ParameterValue<java.lang.Double> clone()
        {@return 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<java.lang.Double>
        Overrides:
        clone in class java.lang.Object