Class ByteArrayConverter

java.lang.Object
org.litebridgedb.convert.converter.ByteArrayConverter
All Implemented Interfaces:
Converter<byte[]>, ConverterFunction<byte[]>, SqlConverter<byte[]>

public class ByteArrayConverter extends Object implements SqlConverter<byte[]>
A converter for byte[] values.

Handles Types.BINARY, Types.VARBINARY, and Types.LONGVARBINARY.

  • Constructor Details

    • ByteArrayConverter

      public ByteArrayConverter()
  • Method Details

    • convert

      public @org.jspecify.annotations.Nullable byte[] convert(@Nullable Object value)
      Converts the given value to a byte[].

      Supports byte[] and arrays of Number instances.

      Specified by:
      convert in interface ConverterFunction<byte[]>
      Parameters:
      value - the value to convert, may be null
      Returns:
      the converted byte[], or null
      Throws:
      IllegalArgumentException - if the value cannot be converted to byte[]
    • type

      public Class<?> type()
      Returns the target Java class this converter handles.
      Specified by:
      type in interface Converter<byte[]>
      Returns:
      byte[].class
    • sqlTypes

      public int[] sqlTypes()
      Returns the SQL types associated with this converter.
      Specified by:
      sqlTypes in interface SqlConverter<byte[]>
      Returns:
      an array containing Types.BINARY, Types.VARBINARY, and Types.LONGVARBINARY