Interface ValueMetaInterface

  • All Superinterfaces:
    Cloneable
    All Known Implementing Classes:
    ValueMeta, ValueMetaBase, ValueMetaBigNumber, ValueMetaBinary, ValueMetaBoolean, ValueMetaDate, ValueMetaInteger, ValueMetaInternetAddress, ValueMetaNone, ValueMetaNumber, ValueMetaSerializable, ValueMetaString, ValueMetaTimestamp

    public interface ValueMetaInterface
    extends Cloneable
    ValueMetaInterface objects are used to determine the characteristics of the row fields. They are typically obtained from a RowMetaInterface object, which is acquired by a call to getInputRowMeta(). The getType() method returns one of the static constants declared by ValueMetaInterface to indicate the PDI field type. Each field type maps to a corresponding native Java type for the actual value.

    PDI Field Type / Java Mapping

    PDI data type Type constant Java data type Description
    String TYPE_STRING java.lang.String A variable (unlimited) length text encoded in UTF-8 (Unicode)
    Integer TYPE_INTEGER java.lang.Long A signed long (64-bit) integer
    Number TYPE_NUMBER java.lang.Double A double precision floating point value
    Big Number TYPE_BIGNUMBER java.math.BigDecimal An arbitrary (unlimited) precision number
    Date TYPE_DATE java.util.Date A date-time value with millisecond precision
    Boolean TYPE_BOOLEAN java.lang.Boolean A boolean value (true or false)
    Binary TYPE_BINARY java.lang.byte[ An array of bytes that contain any type of binary data.

    Storage Types

    In addition to the data type of a field, the storage type (getStorageType()/setStorageType()) is used to interpret the actual field value in a row array.

    Type constant Actual field data type Interpretation
    STORAGE_TYPE_NORMAL As listed above The value in the row array is of the type listed in the data type table above and represents the field's value directly.
    STORAGE_TYPE_BINARY_STRING java.lang.byte[] The field has been created using the “Lazy conversion” feature. This means it is a non-altered sequence of bytes as read from an external medium (usually a file).
    STORAGE_TYPE_INDEXED java.lang.Integer The row value is an integer index into a fixed array of possible values. The ValueMetaInterface object maintains the set of possible values in getIndex()/setIndex().
    • Field Detail

      • TYPE_NONE

        static final int TYPE_NONE
        Value type indicating that the value has no type set
        See Also:
        Constant Field Values
      • TYPE_NUMBER

        static final int TYPE_NUMBER
        Value type indicating that the value contains a floating point double precision number.
        See Also:
        Constant Field Values
      • TYPE_STRING

        static final int TYPE_STRING
        Value type indicating that the value contains a text String.
        See Also:
        Constant Field Values
      • TYPE_DATE

        static final int TYPE_DATE
        Value type indicating that the value contains a Date.
        See Also:
        Constant Field Values
      • TYPE_BOOLEAN

        static final int TYPE_BOOLEAN
        Value type indicating that the value contains a boolean.
        See Also:
        Constant Field Values
      • TYPE_INTEGER

        static final int TYPE_INTEGER
        Value type indicating that the value contains a long integer.
        See Also:
        Constant Field Values
      • TYPE_BIGNUMBER

        static final int TYPE_BIGNUMBER
        Value type indicating that the value contains a floating point precision number with arbitrary precision.
        See Also:
        Constant Field Values
      • TYPE_SERIALIZABLE

        static final int TYPE_SERIALIZABLE
        Value type indicating that the value contains an Object.
        See Also:
        Constant Field Values
      • TYPE_BINARY

        static final int TYPE_BINARY
        Value type indicating that the value contains binary data: BLOB, CLOB, ...
        See Also:
        Constant Field Values
      • TYPE_TIMESTAMP

        static final int TYPE_TIMESTAMP
        Value type indicating that the value contains a date-time with nanosecond precision
        See Also:
        Constant Field Values
      • TYPE_INET

        static final int TYPE_INET
        Value type indicating that the value contains a Internet address
        See Also:
        Constant Field Values
      • typeCodes

        static final String[] typeCodes
        The Constant typeCodes.
      • STORAGE_TYPE_NORMAL

        static final int STORAGE_TYPE_NORMAL
        The storage type is the same as the indicated value type
        See Also:
        Constant Field Values
      • STORAGE_TYPE_BINARY_STRING

        static final int STORAGE_TYPE_BINARY_STRING
        The storage type is binary: read from text but not yet converted to the requested target data type, for lazy conversions.
        See Also:
        Constant Field Values
      • STORAGE_TYPE_INDEXED

        static final int STORAGE_TYPE_INDEXED
        The storage type is indexed. This means that the value is a simple integer index referencing the values in getIndex()
        See Also:
        Constant Field Values
      • storageTypeCodes

        static final String[] storageTypeCodes
        The Constant storageTypeCodes.
      • SORT_TYPE_NOT_SORTED

        static final int SORT_TYPE_NOT_SORTED
        Indicating that the rows are not sorted on this key
        See Also:
        Constant Field Values
      • SORT_TYPE_ASCENDING

        static final int SORT_TYPE_ASCENDING
        Indicating that the rows are not sorted ascending on this key
        See Also:
        Constant Field Values
      • SORT_TYPE_DESCENDING

        static final int SORT_TYPE_DESCENDING
        Indicating that the rows are sorted descending on this key
        See Also:
        Constant Field Values
      • sortTypeCodes

        static final String[] sortTypeCodes
        The Constant sortTypeCodes.
      • TRIM_TYPE_NONE

        static final int TRIM_TYPE_NONE
        Indicating that the string content should NOT be trimmed if conversion is to occur to another data type
        See Also:
        Constant Field Values
      • TRIM_TYPE_LEFT

        static final int TRIM_TYPE_LEFT
        Indicating that the string content should be LEFT trimmed if conversion is to occur to another data type
        See Also:
        Constant Field Values
      • TRIM_TYPE_RIGHT

        static final int TRIM_TYPE_RIGHT
        Indicating that the string content should be RIGHT trimmed if conversion is to occur to another data type
        See Also:
        Constant Field Values
      • TRIM_TYPE_BOTH

        static final int TRIM_TYPE_BOTH
        Indicating that the string content should be LEFT AND RIGHT trimmed if conversion is to occur to another data type
        See Also:
        Constant Field Values
      • DEFAULT_INTEGER_LENGTH

        static final int DEFAULT_INTEGER_LENGTH
        Default integer length for hardcoded metadata integers
        See Also:
        Constant Field Values
    • Method Detail

      • getTypeDescription

        static String getTypeDescription​(int type)
      • getTypeCode

        static int getTypeCode​(String desc)
      • getName

        String getName()
        Gets the name.
        Returns:
        the name
      • setName

        void setName​(String name)
        Sets the name.
        Parameters:
        name - the new name
      • getLength

        int getLength()
        Gets the length.
        Returns:
        the length
      • setLength

        void setLength​(int length)
        Sets the length.
        Parameters:
        length - the new length
      • getPrecision

        int getPrecision()
        Gets the precision.
        Returns:
        the precision
      • setPrecision

        void setPrecision​(int precision)
        Sets the precision.
        Parameters:
        precision - the new precision
      • setLength

        void setLength​(int length,
                       int precision)
        Sets the length.
        Parameters:
        length - the length
        precision - the precision
      • getOrigin

        String getOrigin()
        Gets the origin.
        Returns:
        the origin
      • setOrigin

        void setOrigin​(String origin)
        Sets the origin.
        Parameters:
        origin - the new origin
      • getComments

        String getComments()
        Gets the comments.
        Returns:
        the comments
      • setComments

        void setComments​(String comments)
        Sets the comments for the object implementing the interface.
        Parameters:
        comments - the new comments
      • getType

        int getType()
        Gets the type.
        Returns:
        the type
      • setType

        @Deprecated
        void setType​(int type)
        Deprecated.
        This method is deprecated. The same code is still used underneath.
        Sets the type.
        Parameters:
        type - the new type
      • getStorageType

        int getStorageType()
        Gets the storage type.
        Returns:
        the storage type
      • setStorageType

        void setStorageType​(int storageType)
        Sets the storage type.
        Parameters:
        storageType - the new storage type
      • getTrimType

        int getTrimType()
        Gets the trim type.
        Returns:
        the trim type
      • setTrimType

        void setTrimType​(int trimType)
        Sets the trim type.
        Parameters:
        trimType - the new trim type
      • getIndex

        Object[] getIndex()
        Gets the index.
        Returns:
        the index
      • setIndex

        void setIndex​(Object[] index)
        Sets the index.
        Parameters:
        index - the new index
      • isStorageNormal

        boolean isStorageNormal()
        Checks if is storage normal.
        Returns:
        true, if is storage normal
      • isStorageIndexed

        boolean isStorageIndexed()
        Checks if is storage indexed.
        Returns:
        true, if is storage indexed
      • isStorageBinaryString

        boolean isStorageBinaryString()
        Checks if is storage binary string.
        Returns:
        true, if is storage binary string
      • getConversionMask

        String getConversionMask()
        Gets the conversion mask.
        Returns:
        the conversion mask
      • setConversionMask

        void setConversionMask​(String conversionMask)
        Sets the conversion mask.
        Parameters:
        conversionMask - the new conversion mask
      • getFormatMask

        String getFormatMask()
        Gets a formatting mask using this value's meta information.
        Returns:
        the format mask.
      • getDecimalSymbol

        String getDecimalSymbol()
        Gets the decimal symbol.
        Returns:
        the decimal symbol
      • setDecimalSymbol

        void setDecimalSymbol​(String decimalSymbol)
        Sets the decimal symbol.
        Parameters:
        decimalSymbol - the new decimal symbol
      • getGroupingSymbol

        String getGroupingSymbol()
        Gets the grouping symbol.
        Returns:
        the grouping symbol
      • setGroupingSymbol

        void setGroupingSymbol​(String groupingSymbol)
        Sets the grouping symbol.
        Parameters:
        groupingSymbol - the new grouping symbol
      • getCurrencySymbol

        String getCurrencySymbol()
        Gets the currency symbol.
        Returns:
        the currency symbol
      • setCurrencySymbol

        void setCurrencySymbol​(String currencySymbol)
        Sets the currency symbol.
        Parameters:
        currencySymbol - the new currency symbol
      • getDateFormat

        SimpleDateFormat getDateFormat()
        Gets the date format.
        Returns:
        the date format
      • getDecimalFormat

        DecimalFormat getDecimalFormat()
        Gets the decimal format.
        Returns:
        the decimal format
      • getDecimalFormat

        DecimalFormat getDecimalFormat​(boolean useBigDecimal)
        Gets the decimal format.
        Parameters:
        useBigDecimal - the use big decimal
        Returns:
        the decimal format
      • getStringEncoding

        String getStringEncoding()
        Gets the string encoding.
        Returns:
        the string encoding
      • setStringEncoding

        void setStringEncoding​(String stringEncoding)
        Sets the string encoding.
        Parameters:
        stringEncoding - the new string encoding
      • isSingleByteEncoding

        boolean isSingleByteEncoding()
        Returns:
        true if the String encoding used (storage) is single byte encoded.
      • isNull

        boolean isNull​(Object data)
                throws KettleValueException
        Determine if an object is null. This is the case if data==null or if it's an empty string.
        Parameters:
        data - the object to test
        Returns:
        true if the object is considered null.
        Throws:
        KettleValueException - in case there is a conversion error (only thrown in case of lazy conversion)
      • isCaseInsensitive

        boolean isCaseInsensitive()
        Returns a true of the value object is case insensitive, false if it is case sensitive,
        Returns:
        the caseInsensitive
      • setCaseInsensitive

        void setCaseInsensitive​(boolean caseInsensitive)
        Sets whether or not the value object is case sensitive. This information is useful if the value is involved in string comparisons.
        Parameters:
        caseInsensitive - the caseInsensitive to set
      • isCollatorDisabled

        boolean isCollatorDisabled()
        Returns a true of the value object is case insensitive, false if it is case sensitive,
        Returns:
        the collatorDisabled
      • setCollatorDisabled

        void setCollatorDisabled​(boolean collatorDisabled)
        Sets whether or not the value object should be sorted according to a locale using a collator
        Parameters:
        collatorDisabled - the collatorDisabled to set
      • getCollatorLocale

        Locale getCollatorLocale()
        Get the current Locale of the collator
        Returns:
        the current Collator Locale
      • setCollatorLocale

        void setCollatorLocale​(Locale locale)
        Sets the Locale of the collator
      • getCollatorStrength

        int getCollatorStrength()
        Returns the strength of the collator.
        Returns:
        the collatorStrength
      • isSortedDescending

        boolean isSortedDescending()
        Returns whether or not the value should be sorted in descending order.
        Returns:
        the sortedDescending
      • setSortedDescending

        void setSortedDescending​(boolean sortedDescending)
        Sets whether or not the value should be set in a descending order.
        Parameters:
        sortedDescending - the sortedDescending to set
      • isOutputPaddingEnabled

        boolean isOutputPaddingEnabled()
        Returns true if output padding is enabled (padding to specified length).
        Returns:
        true if output padding is enabled (padding to specified length)
      • setOutputPaddingEnabled

        void setOutputPaddingEnabled​(boolean outputPaddingEnabled)
        Set to true if output padding is to be enabled (padding to specified length).
        Parameters:
        outputPaddingEnabled - Set to true if output padding is to be enabled (padding to specified length)
      • isLargeTextField

        boolean isLargeTextField()
        Returns true if this is a large text field (CLOB, TEXT) with arbitrary length.
        Returns:
        true if this is a large text field (CLOB, TEXT) with arbitrary length.
      • setLargeTextField

        void setLargeTextField​(boolean largeTextField)
        Set to true if the this is to be a large text field (CLOB, TEXT) with arbitrary length.
        Parameters:
        largeTextField - Set to true if this is to be a large text field (CLOB, TEXT) with arbitrary length.
      • isDateFormatLenient

        boolean isDateFormatLenient()
        Returns true of the date format is leniant, false if it is strict.
        See also setDateFormatLenient(boolean)
        Returns:
        true if the the date formatting (parsing) is to be lenient.
      • setDateFormatLenient

        void setDateFormatLenient​(boolean dateFormatLenient)
        Set to true if the date formatting (parsing) is to be set to lenient. Being lenient means that the "date format" is tolerant to some formatting errors. For example, a month specified as "15" will be interpreted as "March":
         15 - (December = 12) = 3 = March.
         
        Set to false for stricter formatting validation.
        Parameters:
        dateFormatLenient - true if the the date formatting (parsing) is to be set to lenient.
      • getDateFormatLocale

        Locale getDateFormatLocale()
        Returns the locale from the date format.
        Returns:
        the date format locale
      • setDateFormatLocale

        void setDateFormatLocale​(Locale dateFormatLocale)
        Sets the locale of the date format.
        Parameters:
        dateFormatLocale - the date format locale to set
      • getDateFormatTimeZone

        TimeZone getDateFormatTimeZone()
        Returns:
        the date format time zone
      • setDateFormatTimeZone

        void setDateFormatTimeZone​(TimeZone dateFormatTimeZone)
        Parameters:
        dateFormatTimeZone - the date format time zone to set
      • getOriginalColumnType

        int getOriginalColumnType()
        store original JDBC RecordSetMetaData for later use
        See Also:
        ResultSetMetaData
      • setOriginalColumnType

        void setOriginalColumnType​(int originalColumnType)
        Sets the original column type.
        Parameters:
        originalColumnType - the new original column type
      • getOriginalColumnTypeName

        String getOriginalColumnTypeName()
        Gets the original column type name.
        Returns:
        the original column type name
      • setOriginalColumnTypeName

        void setOriginalColumnTypeName​(String originalColumnTypeName)
        Sets the original column type name.
        Parameters:
        originalColumnTypeName - the new original column type name
      • getOriginalPrecision

        int getOriginalPrecision()
        Gets the original precision.
        Returns:
        the original precision
      • setOriginalPrecision

        void setOriginalPrecision​(int originalPrecision)
        Sets the original precision.
        Parameters:
        originalPrecision - the new original precision
      • getOriginalScale

        int getOriginalScale()
        Gets the original scale.
        Returns:
        the original scale
      • getOriginalNullable

        int getOriginalNullable()
        Gets the original nullable.
        Returns:
        the original nullable
      • getOriginalSigned

        boolean getOriginalSigned()
        Gets the original signed.
        Returns:
        the original signed
      • setOriginalScale

        void setOriginalScale​(int originalScale)
        Sets the original scale.
        Parameters:
        originalScale - the new original scale
      • isOriginalAutoIncrement

        boolean isOriginalAutoIncrement()
        Checks if is original auto increment.
        Returns:
        true, if is original auto increment
      • setOriginalAutoIncrement

        void setOriginalAutoIncrement​(boolean originalAutoIncrement)
        Sets the original auto increment.
        Parameters:
        originalAutoIncrement - the new original auto increment
      • isOriginalNullable

        int isOriginalNullable()
        Checks if is original nullable.
        Returns:
        the int
      • setOriginalNullable

        void setOriginalNullable​(int originalNullable)
        Sets the original nullable.
        Parameters:
        originalNullable - the new original nullable
      • isOriginalSigned

        boolean isOriginalSigned()
        Checks if is original signed.
        Returns:
        true, if is original signed
      • setOriginalSigned

        void setOriginalSigned​(boolean originalSigned)
        Sets the original signed.
        Parameters:
        originalSigned - the new original signed
      • isString

        boolean isString()
        Checks whether or not the value is a String.
        Returns:
        true if the value is a String.
      • isDate

        boolean isDate()
        Checks whether or not this value is a Date
        Returns:
        true if the value is a Date
      • isBigNumber

        boolean isBigNumber()
        Checks whether or not the value is a Big Number
        Returns:
        true is this value is a big number
      • isNumber

        boolean isNumber()
        Checks whether or not the value is a Number
        Returns:
        true is this value is a number
      • isBoolean

        boolean isBoolean()
        Checks whether or not this value is a boolean
        Returns:
        true if this value has type boolean.
      • isSerializableType

        boolean isSerializableType()
        Checks whether or not this value is of type Serializable
        Returns:
        true if this value has type Serializable
      • isBinary

        boolean isBinary()
        Checks whether or not this value is of type Binary
        Returns:
        true if this value has type Binary
      • isInteger

        boolean isInteger()
        Checks whether or not this value is an Integer
        Returns:
        true if this value is an integer
      • isNumeric

        boolean isNumeric()
        Checks whether or not this Value is Numeric A Value is numeric if it is either of type Number or Integer
        Returns:
        true if the value is either of type Number or Integer
      • getTypeDesc

        String getTypeDesc()
        Return the type of a value in a textual form: "String", "Number", "Integer", "Boolean", "Date", ...
        Returns:
        A String describing the type of value.
      • toStringMeta

        String toStringMeta()
        a String text representation of this Value, optionally padded to the specified length
        Returns:
        a String text representation of this Value, optionally padded to the specified length
      • writeMeta

        void writeMeta​(DataOutputStream outputStream)
                throws KettleFileException
        Write the content of this class (metadata) to the specified output stream.
        Parameters:
        outputStream - the outputstream to write to
        Throws:
        KettleFileException - in case a I/O error occurs
      • writeData

        void writeData​(DataOutputStream outputStream,
                       Object object)
                throws KettleFileException
        Serialize the content of the specified data object to the outputStream. No metadata is written.
        Parameters:
        outputStream - the outputstream to write to
        object - the data object to serialize
        Throws:
        KettleFileException - in case a I/O error occurs
      • readMetaData

        void readMetaData​(DataInputStream inputStream)
                   throws KettleFileException,
                          KettleEOFException
        Read the attributes of this particular value meta object from the specified input stream. Loading the type is not handled here, this should be read from the stream previously!
        Parameters:
        inputStream - the input stream to read from
        Throws:
        KettleFileException - In case there was a IO problem
        KettleEOFException - If we reached the end of the stream
      • compare

        int compare​(Object data1,
                    Object data2)
             throws KettleValueException
        Compare 2 values of the same data type
        Parameters:
        data1 - the first value
        data2 - the second value
        Returns:
        0 if the values are equal, -1 if data1 is smaller than data2 and +1 if it's larger.
        Throws:
        KettleValueException - In case we get conversion errors
      • compare

        int compare​(Object data1,
                    ValueMetaInterface meta2,
                    Object data2)
             throws KettleValueException
        Compare 2 values of the same data type
        Parameters:
        data1 - the first value
        meta2 - the second value's metadata
        data2 - the second value
        Returns:
        0 if the values are equal, -1 if data1 is smaller than data2 and +1 if it's larger.
        Throws:
        KettleValueException - In case we get conversion errors
      • convertData

        Object convertData​(ValueMetaInterface meta2,
                           Object data2)
                    throws KettleValueException
        Convert the specified data to the data type specified in this object.
        Parameters:
        meta2 - the metadata of the object to be converted
        data2 - the data of the object to be converted
        Returns:
        the object in the data type of this value metadata object
        Throws:
        KettleValueException - in case there is a data conversion error
      • convertDataCompatible

        Object convertDataCompatible​(ValueMetaInterface meta2,
                                     Object data2)
                              throws KettleValueException
        Convert the specified data to the data type specified in this object. For String conversion, be compatible with version 2.5.2.
        Parameters:
        meta2 - the metadata of the object to be converted
        data2 - the data of the object to be converted
        Returns:
        the object in the data type of this value metadata object
        Throws:
        KettleValueException - in case there is a data conversion error
      • convertDataUsingConversionMetaData

        Object convertDataUsingConversionMetaData​(Object data)
                                           throws KettleValueException
        Convert an object to the data type specified in the conversion metadata
        Parameters:
        data - The data
        Returns:
        The data converted to the conversion data type
        Throws:
        KettleValueException - in case there is a conversion error.
      • convertDataFromString

        Object convertDataFromString​(String pol,
                                     ValueMetaInterface convertMeta,
                                     String nullif,
                                     String ifNull,
                                     int trim_type)
                              throws KettleValueException
        Convert the specified string to the data type specified in this object.
        Parameters:
        pol - the string to be converted
        convertMeta - the metadata of the object (only string type) to be converted
        nullif - set the object to null if pos equals nullif (IgnoreCase)
        ifNull - set the object to ifNull when pol is empty or null
        trim_type - the trim type to be used (ValueMetaInterface.TRIM_TYPE_XXX)
        Returns:
        the object in the data type of this value metadata object
        Throws:
        KettleValueException - in case there is a data conversion error
      • convertToNormalStorageType

        Object convertToNormalStorageType​(Object object)
                                   throws KettleValueException
        Converts the specified data object to the normal storage type.
        Parameters:
        object - the data object to convert
        Returns:
        the data in a normal storage type
        Throws:
        KettleValueException - In case there is a data conversion error.
      • convertBinaryStringToNativeType

        Object convertBinaryStringToNativeType​(byte[] binary)
                                        throws KettleValueException
        Convert the given binary data to the actual data type.
        - byte[] --> Long (Integer)
        - byte[] --> Double (Number)
        - byte[] --> BigDecimal (BigNumber)
        - byte[] --> Date (Date)
        - byte[] --> Boolean (Boolean)
        - byte[] --> byte[] (Binary)

        Parameters:
        binary - the binary data read from file or database
        Returns:
        the native data type after conversion
        Throws:
        KettleValueException - in case there is a data conversion error
      • convertNormalStorageTypeToBinaryString

        Object convertNormalStorageTypeToBinaryString​(Object object)
                                               throws KettleValueException
        Convert a normal storage type to a binary string object. (for comparison reasons)
        Parameters:
        object - The object expressed in a normal storage type
        Returns:
        a binary string
        Throws:
        KettleValueException - in case there is a data conversion error
      • convertToBinaryStringStorageType

        Object convertToBinaryStringStorageType​(Object object)
                                         throws KettleValueException
        Converts the specified data object to the binary string storage type.
        Parameters:
        object - the data object to convert
        Returns:
        the data in a binary string storage type
        Throws:
        KettleValueException - In case there is a data conversion error.
      • hashCode

        int hashCode​(Object object)
              throws KettleValueException
        Calculate the hashcode of the specified data object
        Parameters:
        object - the data value to calculate a hashcode for
        Returns:
        the calculated hashcode
        Throws:
        KettleValueException - in case there is a data conversion error
      • createOriginalValue

        Value createOriginalValue​(Object data)
                           throws KettleValueException
        Create an old-style value for backward compatibility reasons
        Parameters:
        data - the data to store in the value
        Returns:
        a newly created Value object
        Throws:
        KettleValueException - in case there is a data conversion problem
      • getValueData

        Object getValueData​(Value value)
                     throws KettleValueException
        Extracts the primitive data from an old style Value object
        Parameters:
        value - the old style Value object
        Returns:
        the value's data, NOT the meta data.
        Throws:
        KettleValueException - case there is a data conversion problem
      • getStorageMetadata

        ValueMetaInterface getStorageMetadata()
        Returns the storage Meta data that is needed for internal conversion from BinaryString or String to the specified type. This storage Meta data object survives cloning and should travel through the transformation unchanged as long as the data type remains the same.
        Returns:
        the storage Meta data that is needed for internal conversion from BinaryString or String to the specified type.
      • setStorageMetadata

        void setStorageMetadata​(ValueMetaInterface storageMetadata)
        Sets the storage meta data.
        Parameters:
        storageMetadata - the storage Meta data that is needed for internal conversion from BinaryString or String to the specified type. This storage Meta data object survives cloning and should travel through the transformation unchanged as long as the data type remains the same.
      • getConversionMetadata

        ValueMetaInterface getConversionMetadata()
        This conversion metadata can be attached to a String object to see where it came from and with which mask it was generated, the encoding, the local languages used, padding, etc.
        Returns:
        The conversion metadata
      • setConversionMetadata

        void setConversionMetadata​(ValueMetaInterface conversionMetadata)
        Attach conversion metadata to a String object to see where it came from and with which mask it was generated, the encoding, the local languages used, padding, etc.
        Parameters:
        conversionMetadata - the conversionMetadata to set
      • getMetaXML

        String getMetaXML()
                   throws IOException
        Returns an XML representation of the row metadata.
        Returns:
        an XML representation of the row metadata
        Throws:
        IOException - Thrown in case there is an (Base64/GZip) decoding problem
      • getDataXML

        String getDataXML​(Object value)
                   throws IOException
        Returns an XML representation of the row data.
        Parameters:
        value - The data to serialize as XML
        Returns:
        an XML representation of the row data
        Throws:
        IOException - Thrown in case there is an (Base64/GZip) decoding problem
      • getValue

        Object getValue​(Node node)
                 throws KettleException
        Convert a data XML node to an Object that corresponds to the metadata. This is basically String to Object conversion that is being done.
        Parameters:
        node - the node to retrieve the data value from
        Returns:
        the converted data value
        Throws:
        KettleException - thrown in case there is a problem with the XML to object conversion
      • getNumberOfBinaryStringConversions

        long getNumberOfBinaryStringConversions()
        Returns the number of binary string to native data type conversions done with this object conversions
        Returns:
        the number of binary string to native data type conversions done with this object conversions
      • setNumberOfBinaryStringConversions

        void setNumberOfBinaryStringConversions​(long numberOfBinaryStringConversions)
        Returns the number of binary string to native data type done with this object conversions to set.
        Parameters:
        numberOfBinaryStringConversions - the number of binary string to native data type done with this object conversions to set
      • requiresRealClone

        boolean requiresRealClone()
        Returns true if the data type requires a real copy. Usually a binary or Serializable object.
        Returns:
        boolean
      • isLenientStringToNumber

        boolean isLenientStringToNumber()
        Returns:
        true if string to number conversion is occurring in a lenient fashion, parsing numbers successfully until a non-numeric character is found.
      • setLenientStringToNumber

        void setLenientStringToNumber​(boolean lenientStringToNumber)
        Parameters:
        lenientStringToNumber - Set to if string to number conversion is to occur in a lenient fashion, parsing numbers successfully until a non-numeric character is found.
      • getValueFromSQLType

        ValueMetaInterface getValueFromSQLType​(DatabaseMeta databaseMeta,
                                               String name,
                                               ResultSetMetaData rm,
                                               int index,
                                               boolean ignoreLength,
                                               boolean lazyConversion)
                                        throws KettleDatabaseException
        Investigate JDBC result set metadata at the specified index. If this value metadata is interested in handling this SQL type, it should return the value meta. Otherwise it should return null.
        Parameters:
        databaseMeta - the database metadata to reference capabilities and so on.
        name - The name of the new value
        rm - The result metadata to investigate
        index - The index to look at (1-based)
        ignoreLength - Don't look at the length
        lazyConversion - use lazy conversion
        Returns:
        The value metadata if this value should handle the SQL type at the specified index.
        Throws:
        KettleDatabaseException - In case something went wrong.
      • getMetadataPreview

        ValueMetaInterface getMetadataPreview​(DatabaseMeta databaseMeta,
                                              ResultSet rs)
                                       throws KettleDatabaseException
        This is a similar method to getValueFromSQLType, but it uses a ResultSet from a call to DatabaseMetaData#getColumns(String, String, String, String) The ResultSet must be positioned correctly on the row to read.

        Note that the ValueMeta returned by this RowMeta may not contain actual values. This is a lightweight call using only JDBC metadata and does not make use of SQL statements.

        Parameters:
        databaseMeta - the database metadata to reference capabilities and so on.
        rs - A ResultSet from getColumns, positioned correctly on a column to read.
        Throws:
        KettleDatabaseException
      • getValueFromResultSet

        Object getValueFromResultSet​(DatabaseInterface databaseInterface,
                                     ResultSet resultSet,
                                     int index)
                              throws KettleDatabaseException
        Get a value from a result set column based on the current value metadata
        Parameters:
        databaseInterface - the database metadata to use
        resultSet - The JDBC result set to read from
        index - The column index (0-based)
        Returns:
        The Kettle native data type based on the value metadata
        Throws:
        KettleDatabaseException - in case something goes wrong.
      • setPreparedStatementValue

        void setPreparedStatementValue​(DatabaseMeta databaseMeta,
                                       PreparedStatement preparedStatement,
                                       int index,
                                       Object data)
                                throws KettleDatabaseException
        Set a value on a JDBC prepared statement on the specified position
        Parameters:
        databaseMeta - the database metadata to reference
        preparedStatement - The prepared statement
        index - the column index (1-based)
        data - the value to set
        Throws:
        KettleDatabaseException - in case something goes wrong
      • getNativeDataType

        Object getNativeDataType​(Object object)
                          throws KettleValueException
        This method gives you the native Java data type corresponding to the value meta-data. Conversions from other storage types and other operations are done automatically according to the specified value meta-data.
        Parameters:
        object - The input data
        Returns:
        The native data type
        Throws:
        KettleValueException - in case there is an unexpected data conversion error.
      • getDatabaseColumnTypeDefinition

        String getDatabaseColumnTypeDefinition​(DatabaseInterface databaseInterface,
                                               String tk,
                                               String pk,
                                               boolean use_autoinc,
                                               boolean add_fieldname,
                                               boolean add_cr)
        Ask for suggestions as to how this plugin data type should be represented in the specified database interface
        Parameters:
        databaseInterface - The database type/dialect to get the column type definition for
        tk - Is this a technical key field?
        pk - Is this a primary key field?
        use_autoinc - Use auto-increment?
        add_fieldname - add the fieldname to the column type definition?
        add_cr - add a cariage return to the string?
        Returns:
        The field type definition
      • isIgnoreWhitespace

        boolean isIgnoreWhitespace()
        Is Ignore Whitespace Only applicable for TYPE_STRING comparisons
        Returns:
        true if whitespace should be ignored during string comparison
      • setIgnoreWhitespace

        void setIgnoreWhitespace​(boolean ignoreWhitespace)
        Set Ignore Whitespace Only applicable for TYPE_STRING comparisons
        Parameters:
        ignoreWhitespace - true if whitespace should be ignored during string comparison