Interface StructConverter


  • public interface StructConverter
    PUBLIC: A StuctConverter can be added to a DatabasePlatform It allows custom processing dealing java.sql.Struct types When added to the DatabasePlatform: 1. convertToObject(Struct) will be invoked when a Struct named by the value returned by getStructName() is returned from the database. This conversion happens immediately after the object is returned from the database 2. convertToStruct(Object, Connection) will be invoked when an Object of the class returned by getJavaType() is written to the database. This conversion happens immediately before the object is written to the database Note: Many Structs can also be mapped with mappings StructureMapping and ObjectRelationalDataTypeDescriptor This class provides support for advanced types of Structures that require some processing immediately before writing to the database or immediately after reading from the database.
    See Also:
    StructureMapping, ObjectRelationalDataTypeDescriptor
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.Object convertToObject​(java.sql.Struct struct)
      PUBLIC: This method will be invoked internally when reading a Struct from the database Implementers should put any custom conversion logic in this method
      java.sql.Struct convertToStruct​(java.lang.Object struct, java.sql.Connection connection)
      PUBLIC: This method will be invoked internally when writing an Object to the database Implementers should put any custom conversion logic in this method
      java.lang.Class getJavaType()
      PUBLIC:
      java.lang.String getStructName()
      PUBLIC:
    • Method Detail

      • getStructName

        java.lang.String getStructName()
        PUBLIC:
        Returns:
        The value return by getSQLTypeName() called when called on the appropriate Struct
      • getJavaType

        java.lang.Class getJavaType()
        PUBLIC:
        Returns:
        The Java Class to perform conversions on
      • convertToObject

        java.lang.Object convertToObject​(java.sql.Struct struct)
                                  throws java.sql.SQLException
        PUBLIC: This method will be invoked internally when reading a Struct from the database Implementers should put any custom conversion logic in this method
        Parameters:
        struct - the Struct that will be read
        Returns:
        The Object converted back from the Struct
        Throws:
        java.sql.SQLException
      • convertToStruct

        java.sql.Struct convertToStruct​(java.lang.Object struct,
                                        java.sql.Connection connection)
                                 throws java.sql.SQLException
        PUBLIC: This method will be invoked internally when writing an Object to the database Implementers should put any custom conversion logic in this method
        Parameters:
        struct - The Object to convert
        connection - The JDBC connection
        Returns:
        The Object as a Struct
        Throws:
        java.sql.SQLException