Class GenericConverter<T>

java.lang.Object
org.litebridgedb.convert.converter.GenericConverter<T>
Type Parameters:
T - the target type
All Implemented Interfaces:
Converter<T>, ConverterFunction<T>
Direct Known Subclasses:
GenericSqlConverter

public class GenericConverter<T> extends Object implements Converter<T>
A generic implementation of Converter that uses a ConverterFunction for the conversion logic.
  • Constructor Details

    • GenericConverter

      public GenericConverter(Class<T> type, ConverterFunction<T> conversionFunction)
      Constructs a new GenericConverter for the specified type and conversion function.
      Parameters:
      type - the target Java class
      conversionFunction - the conversion logic
  • Method Details

    • type

      public Class<T> type()
      Returns the target Java class this converter handles.
      Specified by:
      type in interface Converter<T>
      Returns:
      the target Java class
    • convert

      public @Nullable T convert(@Nullable Object value)
      Converts the given value to the target type using the provided conversion function.
      Specified by:
      convert in interface ConverterFunction<T>
      Parameters:
      value - the value to convert, may be null
      Returns:
      the converted value, or null