Interface LogicalType<T>


public interface LogicalType<T>
Defines a logical type which can translate between one or more Java types and one or more JDBC types. This should be independent of the underlying database dialect.
  • Method Details

    • getName

      String getName()
      Returns a descriptive name for this logical type.
    • getAllTypes

      Set<Class<?>> getAllTypes()
      Returns the Java types that are handled by this logical type. Only one logical type can handle any given Java type.
    • getAllJdbcReadTypes

      Set<Integer> getAllJdbcReadTypes()
      Returns the set of JDBC types that can be translated into this logical type.
    • getDefaultJdbcWriteType

      int getDefaultJdbcWriteType()
      Returns the default JDBC type to use when writing values to the database. This can be overridden by each database provider in the SchemaProperties.
    • isAllowedAsPrimaryKey

      boolean isAllowedAsPrimaryKey()
      Returns a boolean specifying if this type can be used as a primary key value.
      Returns:
      if it's allowed or not
    • parse

      T parse(String input) throws IllegalArgumentException
      Attempts to parse a string into a value of this logical type.
      Throws:
      IllegalArgumentException
    • parseDefault

      T parseDefault(String input) throws IllegalArgumentException
      Same as parse(String), but adds any necessary validation when the value is being used as a default value for a column.
      Throws:
      IllegalArgumentException
    • validate

      Object validate(Object value) throws IllegalArgumentException
      Verifies that a value can be stored in the database. Returns the same value or a canonically equivalent value.
      Throws:
      IllegalArgumentException
    • putToDatabase

      void putToDatabase(EntityManager manager, PreparedStatement stmt, int index, T value, int jdbcType) throws SQLException
      Sets a value in a JDBC statement.
      Throws:
      SQLException
    • pullFromDatabase

      T pullFromDatabase(EntityManager manager, ResultSet res, Class<T> type, String columnName) throws SQLException
      Reads a value from a JDBC result set.
      Throws:
      SQLException
    • pullFromDatabase

      T pullFromDatabase(EntityManager manager, ResultSet res, Class<T> type, int columnIndex) throws SQLException
      Reads a value from a JDBC result set.
      Throws:
      SQLException
    • shouldCache

      boolean shouldCache(Class<?> type)
      Deprecated.
      since 0.25. Entities and values now no longer cached.
    • shouldStore

      boolean shouldStore(Class<?> type)
      Returns whether the type may be put inside the entities value store.
    • valueEquals

      boolean valueEquals(Object val1, Object val2)
    • valueToString

      String valueToString(T value)