public final class Converters extends Object
DataContexts
with TypeConverters, which allows for automatic conversion of values
on data read and write operations.| Modifier and Type | Method and Description |
|---|---|
static DataContext |
addTypeConverter(DataContext dataContext,
Column column,
TypeConverter<?,?> converter)
Adds a type converter to a specific column in the
DataContext. |
static UpdateableDataContext |
addTypeConverter(UpdateableDataContext dataContext,
Column column,
TypeConverter<?,?> converter)
Adds a type converter to a specific column in the
DataContext. |
static DataContext |
addTypeConverters(DataContext dataContext,
Map<Column,TypeConverter<?,?>> converters)
Adds a collection of type converters to specific columns in the
DataContext |
static UpdateableDataContext |
addTypeConverters(UpdateableDataContext dataContext,
Map<Column,TypeConverter<?,?>> converters)
Adds a collection of type converters to specific columns in the
DataContext |
static Map<Column,TypeConverter<?,?>> |
autoDetectConverters(DataContext dataContext,
List<Column> columns,
int sampleSize)
Auto-detects / guesses the type converters to be applied on set of
columns.
|
static Map<Column,TypeConverter<?,?>> |
autoDetectConverters(DataContext dataContext,
Table table,
int sampleSize)
Auto-detects / guesses the type converters to be applied on a table.
|
protected static <RB extends RowBuilder<?>> |
convertRow(RB rowBuilder,
Map<Column,TypeConverter<?,?>> converters)
Converts values in a
RowBuilder. |
public static UpdateableDataContext addTypeConverter(UpdateableDataContext dataContext, Column column, TypeConverter<?,?> converter)
DataContext.dataContext - the DataContext to decoratecolumn - the column which holds values to convertconverter - the converter to use on the specified columnpublic static DataContext addTypeConverter(DataContext dataContext, Column column, TypeConverter<?,?> converter)
DataContext.dataContext - the DataContext to decoratecolumn - the column which holds values to convertconverter - the converter to use on the specified columnpublic static UpdateableDataContext addTypeConverters(UpdateableDataContext dataContext, Map<Column,TypeConverter<?,?>> converters)
DataContextdataContext - the DataContext to decorateconverters - a map containing columns and mapped type converters.public static DataContext addTypeConverters(DataContext dataContext, Map<Column,TypeConverter<?,?>> converters)
DataContextdataContext - the DataContext to decorateconverters - a map containing columns and mapped type converters.public static Map<Column,TypeConverter<?,?>> autoDetectConverters(DataContext dataContext, List<Column> columns, int sampleSize)
dataContext - the DataContext that holds the data.columns - the columns to inspect to find type conversion candidates.sampleSize - the max amount of rows to query for doing auto-detection. Use
Integer.MAX_VALUE if no constraint should be put on
the number of records to sample.Columns and TypeConverters which can be
used (eg. with the addTypeConverters(DataContext, Map)
method) to decorate the DataContext with type converters.public static Map<Column,TypeConverter<?,?>> autoDetectConverters(DataContext dataContext, Table table, int sampleSize)
dataContext - the DataContext that holds the data.table - the table to inspect to find type conversion candidates. This
table will hold all columns of the result.sampleSize - the max amount of rows to query for doing auto-detection. Use
Integer.MAX_VALUE if no constraint should be put on
the number of records to sample.Columns and TypeConverters which can be
used (eg. with the addTypeConverters(DataContext, Map)
method) to decorate the DataContext with type converters.protected static <RB extends RowBuilder<?>> RB convertRow(RB rowBuilder, Map<Column,TypeConverter<?,?>> converters)
RowBuilder.rowBuilder - converters - Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.