public final class Convert
extends java.lang.Object
 This class provides less type-safety than the general jOOQ API methods. For
 instance, it accepts arbitrary Converter objects in methods like
 convert(Collection, Converter) and convert(Object, Class),
 trying to retrofit the Object argument to the type provided in
 Converter.fromType() before performing the actual conversion.
| Modifier and Type | Field and Description | 
|---|---|
| static java.util.Set<java.lang.String> | FALSE_VALUESAll string values that can be transformed into a boolean  falsevalue. | 
| static java.util.Set<java.lang.String> | TRUE_VALUESAll string values that can be transformed into a boolean  truevalue. | 
| Modifier and Type | Method and Description | 
|---|---|
| static <T> java.util.List<T> | convert(java.util.Collection<?> collection,
       java.lang.Class<? extends T> type)Convert a collection of objects to a list of  T, usingconvert(Object, Class) | 
| static <U> java.util.List<U> | convert(java.util.Collection<?> collection,
       Converter<?,? extends U> converter)Convert a collection of objects to a list of  T, usingconvert(Object, Converter) | 
| static java.lang.Object[] | convert(java.lang.Object[] values,
       java.lang.Class<?>[] types)Convert an array of values to a matching data type
 
 This converts  values[i]totypes[i] | 
| static java.lang.Object[] | convert(java.lang.Object[] values,
       Field<?>[] fields)Convert an array of values to a matching data type
 
 This converts  values[i]tofields[i].getType() | 
| static <T> T | convert(java.lang.Object from,
       java.lang.Class<? extends T> toClass)Convert an object to a type. | 
| static <U> U | convert(java.lang.Object from,
       Converter<?,? extends U> converter)Convert an object to a type. | 
| static java.lang.Object[] | convertArray(java.lang.Object[] from,
            java.lang.Class<?> toClass)Convert an array into another one by these rules
 
 
 If  toClassis not an array class, then make it an array
 class first
 IftoClassis an array class, then create an instance
 from it, and convert all elements in thefromarray one by
 one, usingconvert(Object, Class) | 
| static <U> U[] | convertArray(java.lang.Object[] from,
            Converter<?,? extends U> converter)Convert an array into another one using a converter
 
 This uses  convertArray(Object[], Class)to convert the array to
 an array ofConverter.fromType()first, before converting that
 array again toConverter.toType() | 
| static <U> U[] | convertCollection(java.util.Collection from,
                 java.lang.Class<? extends U[]> to) | 
public static final java.util.Set<java.lang.String> TRUE_VALUES
true value.public static final java.util.Set<java.lang.String> FALSE_VALUES
false value.public static final java.lang.Object[] convert(java.lang.Object[] values,
                                               Field<?>[] fields)
 This converts values[i] to fields[i].getType()
public static final java.lang.Object[] convert(java.lang.Object[] values,
                                               java.lang.Class<?>[] types)
 This converts values[i] to types[i]
public static final <U> U[] convertArray(java.lang.Object[] from,
                                         Converter<?,? extends U> converter)
                                  throws DataTypeException
 This uses convertArray(Object[], Class) to convert the array to
 an array of Converter.fromType() first, before converting that
 array again to Converter.toType()
from - The array to convertconverter - The data type converterDataTypeException - - When the conversion is not possiblepublic static final java.lang.Object[] convertArray(java.lang.Object[] from,
                                                    java.lang.Class<?> toClass)
                                             throws DataTypeException
toClass is not an array class, then make it an array
 class firsttoClass is an array class, then create an instance
 from it, and convert all elements in the from array one by
 one, using convert(Object, Class)from - The array to converttoClass - The target array typeDataTypeException - - When the conversion is not possiblepublic static final <U> U[] convertCollection(java.util.Collection from,
                                              java.lang.Class<? extends U[]> to)
public static final <U> U convert(java.lang.Object from,
                                  Converter<?,? extends U> converter)
                           throws DataTypeException
from - The source objectconverter - The data type converterDataTypeException - - When the conversion is not possiblepublic static final <T> T convert(java.lang.Object from,
                                  java.lang.Class<? extends T> toClass)
                           throws DataTypeException
null is always converted to null,
 regardless of the target type.StringObjectNumber types can be converted to other
 Number typesNumber or String types can be converted
 to Boolean. Possible (case-insensitive) values for
 true:
 11.0yyestrueonenabled
 Possible (case-insensitive) values for false:
 
00.0nnofalseoffdisabled
 All other values evaluate to null
Date subtypes (Date, Time,
 Timestamp), as well as most Temporal subtypes (
 LocalDate, LocalTime, LocalDateTime,
 OffsetTime, OffsetDateTime, as well as Instant)
 can be converted into each other.String types can be converted into URI,
 URL and Filenull is converted into the initialisation value (e.g.
 0 for int, false for
 boolean)byte[] can be converted into String, using
 the platform's default charsetObject[] can be converted into any other array type, if
 array elements can be converted, tooDataTypeExceptionfrom - The object to converttoClass - The target typeDataTypeException - - When the conversion is not possiblepublic static final <T> java.util.List<T> convert(java.util.Collection<?> collection,
                                                  java.lang.Class<? extends T> type)
                                           throws DataTypeException
T, using
 convert(Object, Class)collection - The list of objectstype - The target typeDataTypeException - - When the conversion is not possibleconvert(Object, Class)public static final <U> java.util.List<U> convert(java.util.Collection<?> collection,
                                                  Converter<?,? extends U> converter)
                                           throws DataTypeException
T, using
 convert(Object, Converter)collection - The collection of objectsconverter - The data type converterDataTypeException - - When the conversion is not possibleconvert(Object, Converter)Copyright © 2018. All Rights Reserved.