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 Details

  • Method Details

    • type

      public 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 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 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 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 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 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 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 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 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