Class DefaultTypeManager

java.lang.Object
io.ebeaninternal.server.type.DefaultTypeManager
All Implemented Interfaces:
TypeManager

public final class DefaultTypeManager extends Object implements TypeManager
Default implementation of TypeManager.

Manages the list of ScalarType that is available.

  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultTypeManager(io.ebean.DatabaseBuilder.Settings config, BootupClasses bootupClasses)
    Create the DefaultTypeManager.
  • Method Summary

    Modifier and Type
    Method
    Description
    convert(Object value, int toJdbcType)
    Convert the Object to the required datatype.
    io.ebean.core.type.ScalarType<?>
    dbArrayType(Class<?> type, Type genericType, boolean nullable)
    Return the ScalarType used to handle DB ARRAY.
    io.ebean.core.type.ScalarType<?>
    dbJsonType(DeployBeanProperty prop, int dbType, int dbLength)
    Return the ScalarType used to handle JSON content.
    io.ebean.core.type.ScalarType<?>
    Return the ScalarType used to handle HSTORE (Mapinvalid input: '<'String,String>).
    io.ebean.core.type.ScalarType<?>
    enumType(Class<? extends Enum<?>> enumType, jakarta.persistence.EnumType type)
    Create a ScalarType for an Enum that has additional mapping.
    Return the Geometry type binder if provided.
    io.ebean.core.type.ScalarType<?>
    type(int jdbcType)
    Return the ScalarType for the given jdbc type as per java.sql.Types.
    io.ebean.core.type.ScalarType<?>
    type(Class<?> type)
    This can return null if no matching ScalarType is found.
    io.ebean.core.type.ScalarType<?>
    type(Class<?> type, int jdbcType)
    Return a ScalarType for a given class.
    io.ebean.core.type.ScalarType<?>
    type(Type propertyType, Class<?> propertyClass)
    Find and return the ScalarType taking into account the property type with generics.
    io.ebean.core.type.ScalarType<?>
    type(String cast)
    Return the scalar type for the given logical type.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DefaultTypeManager

      public DefaultTypeManager(io.ebean.DatabaseBuilder.Settings config, BootupClasses bootupClasses)
      Create the DefaultTypeManager.
  • Method Details

    • type

      public io.ebean.core.type.ScalarType<?> type(String cast)
      Description copied from interface: TypeManager
      Return the scalar type for the given logical type.
      Specified by:
      type in interface TypeManager
    • type

      public io.ebean.core.type.ScalarType<?> type(int jdbcType)
      Return the ScalarType for the given jdbc type as per java.sql.Types.
      Specified by:
      type in interface TypeManager
      Parameters:
      jdbcType - as per java.sql.Types
    • type

      public io.ebean.core.type.ScalarType<?> type(Type propertyType, Class<?> propertyClass)
      Description copied from interface: TypeManager
      Find and return the ScalarType taking into account the property type with generics.

      For example Array based ScalarType for types like List<String>.

      Specified by:
      type in interface TypeManager
    • type

      public io.ebean.core.type.ScalarType<?> type(Class<?> type)
      This can return null if no matching ScalarType is found.
      Specified by:
      type in interface TypeManager
    • geoTypeBinder

      public GeoTypeBinder geoTypeBinder()
      Description copied from interface: TypeManager
      Return the Geometry type binder if provided.
      Specified by:
      geoTypeBinder in interface TypeManager
    • dbMapType

      public io.ebean.core.type.ScalarType<?> dbMapType()
      Description copied from interface: TypeManager
      Return the ScalarType used to handle HSTORE (Mapinvalid input: '<'String,String>).
      Specified by:
      dbMapType in interface TypeManager
    • dbArrayType

      public io.ebean.core.type.ScalarType<?> dbArrayType(Class<?> type, Type genericType, boolean nullable)
      Description copied from interface: TypeManager
      Return the ScalarType used to handle DB ARRAY.
      Specified by:
      dbArrayType in interface TypeManager
    • dbJsonType

      public io.ebean.core.type.ScalarType<?> dbJsonType(DeployBeanProperty prop, int dbType, int dbLength)
      Description copied from interface: TypeManager
      Return the ScalarType used to handle JSON content.

      Note that type expected to be JsonNode or Map.

      Specified by:
      dbJsonType in interface TypeManager
    • type

      public io.ebean.core.type.ScalarType<?> type(Class<?> type, int jdbcType)
      Return a ScalarType for a given class.

      Used for java.util.Date and java.util.Calendar which can be mapped to different jdbcTypes in a single system.

      Specified by:
      type in interface TypeManager
    • convert

      public Object convert(Object value, int toJdbcType)
      Convert the Object to the required datatype. The
      Parameters:
      value - the Object value
      toJdbcType - the type as per java.sql.Types.
    • enumType

      public io.ebean.core.type.ScalarType<?> enumType(Class<? extends Enum<?>> enumType, jakarta.persistence.EnumType type)
      Create a ScalarType for an Enum that has additional mapping.

      The reason for this is that often in a DB there will be short codes used such as A,I,N rather than the ACTIVE, INACTIVE, NEW. So there really needs to be a mapping from the nicely named enumeration values to the typically much shorter codes used in the DB.

      Specified by:
      enumType in interface TypeManager