Class ModelInputConverter

  • All Implemented Interfaces:
    InputParser.InputConverter<java.lang.Object>

    public class ModelInputConverter
    extends java.lang.Object
    implements InputParser.InputConverter<java.lang.Object>
    Input converter implementing the ModelAccess conversion conventions. An input converter for ModelAccess shall allow for more homogeneous generated code compared to InputParser-based code. Moreover, this shall allow for encapsulating future changes to input/output conventions for ModelAccess.
    Author:
    Holger Eichelberger, SSE
    • Constructor Detail

      • ModelInputConverter

        protected ModelInputConverter()
        Prevents external creation.
    • Method Detail

      • toInteger

        public int toInteger​(java.lang.Object data)
                      throws java.io.IOException
        Description copied from interface: InputParser.InputConverter
        Converts parsed data returned by InputParser.ParseResult to integer.
        Specified by:
        toInteger in interface InputParser.InputConverter<java.lang.Object>
        Parameters:
        data - the obtained data
        Returns:
        the converted integer
        Throws:
        java.io.IOException - if conversion fails
      • toByte

        public byte toByte​(java.lang.Object data)
                    throws java.io.IOException
        Description copied from interface: InputParser.InputConverter
        Converts parsed data returned by InputParser.ParseResult to byte.
        Specified by:
        toByte in interface InputParser.InputConverter<java.lang.Object>
        Parameters:
        data - the obtained data
        Returns:
        the converted integer
        Throws:
        java.io.IOException - if conversion fails
      • toLong

        public long toLong​(java.lang.Object data)
                    throws java.io.IOException
        Description copied from interface: InputParser.InputConverter
        Converts parsed data returned by InputParser.ParseResult to long.
        Specified by:
        toLong in interface InputParser.InputConverter<java.lang.Object>
        Parameters:
        data - the obtained data
        Returns:
        the converted long
        Throws:
        java.io.IOException - if conversion fails
      • toShort

        public short toShort​(java.lang.Object data)
                      throws java.io.IOException
        Description copied from interface: InputParser.InputConverter
        Converts parsed data returned by InputParser.ParseResult to short.
        Specified by:
        toShort in interface InputParser.InputConverter<java.lang.Object>
        Parameters:
        data - the obtained data
        Returns:
        the converted long
        Throws:
        java.io.IOException - if conversion fails
      • toString

        public java.lang.String toString​(java.lang.Object data)
                                  throws java.io.IOException
        Description copied from interface: InputParser.InputConverter
        Converts parsed data returned by InputParser.ParseResult to String.
        Specified by:
        toString in interface InputParser.InputConverter<java.lang.Object>
        Parameters:
        data - the obtained data
        Returns:
        the converted String
        Throws:
        java.io.IOException - if conversion fails
      • toDouble

        public double toDouble​(java.lang.Object data)
                        throws java.io.IOException
        Description copied from interface: InputParser.InputConverter
        Converts parsed data returned by InputParser.ParseResult to double.
        Specified by:
        toDouble in interface InputParser.InputConverter<java.lang.Object>
        Parameters:
        data - the obtained data
        Returns:
        the converted double
        Throws:
        java.io.IOException - if conversion fails
      • toFloat

        public float toFloat​(java.lang.Object data)
                      throws java.io.IOException
        Description copied from interface: InputParser.InputConverter
        Converts parsed data returned by InputParser.ParseResult to float.
        Specified by:
        toFloat in interface InputParser.InputConverter<java.lang.Object>
        Parameters:
        data - the obtained data
        Returns:
        the converted float
        Throws:
        java.io.IOException - if conversion fails
      • toBoolean

        public boolean toBoolean​(java.lang.Object data)
                          throws java.io.IOException
        Description copied from interface: InputParser.InputConverter
        Converts parsed data returned by InputParser.ParseResult to Boolean.
        Specified by:
        toBoolean in interface InputParser.InputConverter<java.lang.Object>
        Parameters:
        data - the obtained data
        Returns:
        the converted Boolean
        Throws:
        java.io.IOException - if conversion fails
      • toIntegerArray

        public int[] toIntegerArray​(java.lang.Object data)
                             throws java.io.IOException
        Description copied from interface: InputParser.InputConverter
        Converts parsed data returned by InputParser.ParseResult to an integer array.
        Specified by:
        toIntegerArray in interface InputParser.InputConverter<java.lang.Object>
        Parameters:
        data - the obtained data
        Returns:
        the converted integer array
        Throws:
        java.io.IOException - if conversion fails
      • toDoubleArray

        public double[] toDoubleArray​(java.lang.Object data)
                               throws java.io.IOException
        Description copied from interface: InputParser.InputConverter
        Converts parsed data returned by InputParser.ParseResult to a double array.
        Specified by:
        toDoubleArray in interface InputParser.InputConverter<java.lang.Object>
        Parameters:
        data - the obtained data
        Returns:
        the converted double array
        Throws:
        java.io.IOException - if conversion fails
      • toStringArray

        public java.lang.String[] toStringArray​(java.lang.Object data)
                                         throws java.io.IOException
        Description copied from interface: InputParser.InputConverter
        Converts parsed data returned by InputParser.ParseResult to a String array.
        Specified by:
        toStringArray in interface InputParser.InputConverter<java.lang.Object>
        Parameters:
        data - the obtained data
        Returns:
        the converted integer array
        Throws:
        java.io.IOException - if conversion fails
      • toByteArray

        public byte[] toByteArray​(java.lang.Object data)
                           throws java.io.IOException
        Description copied from interface: InputParser.InputConverter
        Converts parsed data returned by InputParser.ParseResult to a byte array.
        Specified by:
        toByteArray in interface InputParser.InputConverter<java.lang.Object>
        Parameters:
        data - the obtained data
        Returns:
        the converted double array
        Throws:
        java.io.IOException - if conversion fails
      • toObject

        public java.lang.Object toObject​(java.lang.Object data)
                                  throws java.io.IOException
        Description copied from interface: InputParser.InputConverter
        Converts parsed data returned by InputParser.ParseResult to an object. [fallback dummy]
        Specified by:
        toObject in interface InputParser.InputConverter<java.lang.Object>
        Parameters:
        data - the obtained data
        Returns:
        the converted double array
        Throws:
        java.io.IOException - if conversion fails