Class LobCoercion

java.lang.Object
io.github.connellite.util.internal.LobCoercion

public class LobCoercion extends Object
JDBC LOB coercion used by TypeCoercionUtil.
  • Constructor Details

    • LobCoercion

      public LobCoercion()
  • Method Details

    • supports

      public static boolean supports(Class<?> targetType)
      Returns whether targetType is Blob, Clob, or NClob.
      Parameters:
      targetType - desired type, never null
      Returns:
      true for a LOB target
    • coerce

      public static <T> T coerce(Object raw, Class<T> targetType)
      Coerces raw toward a LOB targetType. supports(Class) is true for targetType. An incompatible value yields null.
      Type Parameters:
      T - target type
      Parameters:
      raw - source value, never null
      targetType - LOB type to coerce toward
      Returns:
      coerced LOB, or null when raw does not match targetType
      Throws:
      TypeCoercionException - when a matching value cannot be stored in a LOB
    • clobToString

      public static String clobToString(Clob clob)
      Full text of clob, or null if clob is null.
    • blobToString

      public static String blobToString(Blob blob)
      UTF-8 text of blob.