Package com.ptsmods.mysqlw.collection
Class DbCF
java.lang.Object
com.ptsmods.mysqlw.collection.DbCF
Database Collection Functions
Functions used to convert instances of various classes to and from Strings.
Functions used to convert instances of various classes to and from Strings.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final BiFunction<Byte,
DbCollection, String> static final BiFunction<Double,
DbCollection, String> static final BiFunction<Float,
DbCollection, String> static final BiFunction<Integer,
DbCollection, String> static final BiFunction<Long,
DbCollection, String> static final BiFunction<Short,
DbCollection, String> static final BiFunction<String,
DbCollection, String> static final BiFunction<String,
DbCollection, Byte> static final BiFunction<String,
DbCollection, Double> static final BiFunction<String,
DbCollection, Float> static final BiFunction<String,
DbCollection, Integer> static final BiFunction<String,
DbCollection, Long> static final BiFunction<String,
DbCollection, Short> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <E> BiFunction<String,
DbCollection, DbList<E>> dbListFromStringFunc
(Class<E> type) static <E> BiFunction<String,
DbCollection, DbList<E>> dbListFromStringFunc
(BiFunction<E, DbCollection, String> elementToString, BiFunction<String, DbCollection, E> elementFromString) static <E> BiFunction<DbList<E>,
DbCollection, String> static <K,
V> BiFunction<String, DbCollection, DbMap<K, V>> dbMapFromStringFunc
(Class<K> keyType, Class<V> valueType) static <K,
V> BiFunction<String, DbCollection, DbMap<K, V>> dbMapFromStringFunc
(BiFunction<K, DbCollection, String> keyToString, BiFunction<V, DbCollection, String> valueToString, BiFunction<String, DbCollection, K> keyFromString, BiFunction<String, DbCollection, V> valueFromString) static <K,
V> BiFunction<DbMap<K, V>, DbCollection, String> static <E> BiFunction<String,
DbCollection, DbSet<E>> dbSetFromStringFunc
(Class<E> type) static <E> BiFunction<String,
DbCollection, DbSet<E>> dbSetFromStringFunc
(BiFunction<E, DbCollection, String> elementToString, BiFunction<String, DbCollection, E> elementFromString) static <E> BiFunction<DbSet<E>,
DbCollection, String> static <T> Pair<BiFunction<T,
DbCollection, String>, BiFunction<String, DbCollection, T>> static <T> BiFunction<String,
DbCollection, T> static <T> BiFunction<T,
DbCollection, String> static <T> void
registerConverters
(Class<T> type, BiFunction<T, DbCollection, String> toString, BiFunction<String, DbCollection, T> fromString) Used to register a bifunction to convert Objects of type T to Strings and a bifunction to convert Strings to Objects of type T.
-
Field Details
-
strFunc
-
toByteFunc
-
fromByteFunc
-
toShortFunc
-
fromShortFunc
-
toIntFunc
-
fromIntFunc
-
toLongFunc
-
fromLongFunc
-
toFloatFunc
-
fromFloatFunc
-
toDoubleFunc
-
fromDoubleFunc
-
-
Constructor Details
-
DbCF
public DbCF()
-
-
Method Details
-
dbListToStringFunc
- Type Parameters:
E
- The type of the elements in this list.- Returns:
- A bifunction to convert a DbList into a String which can be read by
dbListFromStringFunc(BiFunction, BiFunction)
anddbListFromStringFunc(Class)
. - See Also:
-
dbListFromStringFunc
- Type Parameters:
E
- The type of the elements in this list.- Parameters:
type
- The class of the elements in this list. Used to get the type converters registered withregisterConverters(Class, BiFunction, BiFunction)
.- Returns:
- A bifunction to read the String representation of a DbList produced by
dbListToStringFunc()
. - See Also:
-
dbListFromStringFunc
public static <E> BiFunction<String,DbCollection, dbListFromStringFuncDbList<E>> (BiFunction<E, DbCollection, String> elementToString, BiFunction<String, DbCollection, E> elementFromString) - Type Parameters:
E
- The type of the elements in this list.- Parameters:
elementToString
- The bifunction to convert the elements in this list to Strings.elementFromString
- The bifunction to convert Strings to elements fit for this list.- Returns:
- A bifunction to read the String representation of a DbList produced by
dbListToStringFunc()
. - See Also:
-
dbSetToStringFunc
- Type Parameters:
E
- The type of the elements in this set.- Returns:
- A bifunction to convert a DbSet into a String which can be read by
dbSetFromStringFunc(BiFunction, BiFunction)
anddbSetFromStringFunc(Class)
. - See Also:
-
dbSetFromStringFunc
- Type Parameters:
E
- The type of the elements in this set.- Parameters:
type
- The class of the elements in this set. Used to get the type converters registered withregisterConverters(Class, BiFunction, BiFunction)
.- Returns:
- A bifunction to read the String representation of a DbSet produced by
dbSetToStringFunc()
. - See Also:
-
dbSetFromStringFunc
public static <E> BiFunction<String,DbCollection, dbSetFromStringFuncDbSet<E>> (BiFunction<E, DbCollection, String> elementToString, BiFunction<String, DbCollection, E> elementFromString) - Type Parameters:
E
- The type of the elements in this list.- Parameters:
elementToString
- The bifunction to convert the elements in this list to Strings.elementFromString
- The bifunction to convert Strings to elements fit for this list.- Returns:
- A bifunction to read the String representation of a DbList produced by
dbListToStringFunc()
. - See Also:
-
dbMapToStringFunc
- Type Parameters:
K
- The type of the keys in this map.V
- The type of the values in this map.- Returns:
- A bifunction to convert a DbMap into a String which can be read by
dbMapFromStringFunc(BiFunction, BiFunction, BiFunction, BiFunction)
anddbMapFromStringFunc(Class, Class)
. - See Also:
-
dbMapFromStringFunc
public static <K,V> BiFunction<String,DbCollection, dbMapFromStringFuncDbMap<K, V>> (Class<K> keyType, Class<V> valueType) - Type Parameters:
K
- The type of the keys in this map.V
- The type of the values in this map.- Parameters:
keyType
- The class of the keys in this map. Used to get the type converters registered withregisterConverters(Class, BiFunction, BiFunction)
.valueType
- The class of the values in this map. Used to get the type converters registered withregisterConverters(Class, BiFunction, BiFunction)
.- Returns:
- A bifunction to read the String representation of a DbMap produced by
dbMapToStringFunc()
. - See Also:
-
dbMapFromStringFunc
public static <K,V> BiFunction<String,DbCollection, dbMapFromStringFuncDbMap<K, V>> (BiFunction<K, DbCollection, String> keyToString, BiFunction<V, DbCollection, String> valueToString, BiFunction<String, DbCollection, K> keyFromString, BiFunction<String, DbCollection, V> valueFromString) - Type Parameters:
K
- The type of the keys in this map.V
- The type of the values in this map.- Parameters:
keyToString
- The bifunction to convert the keys in this map to Strings.valueToString
- The bifunction to convert the values in this map to Strings.keyFromString
- The bifunction to convert Strings to keys fit for this map.valueFromString
- The bifunction to convert Strings to values fit for this map.- Returns:
- A bifunction to read the String representation of a DbMap produced by
dbMapToStringFunc()
. - See Also:
-
registerConverters
public static <T> void registerConverters(Class<T> type, BiFunction<T, DbCollection, String> toString, BiFunction<String, DbCollection, T> fromString) Used to register a bifunction to convert Objects of type T to Strings and a bifunction to convert Strings to Objects of type T.- Type Parameters:
T
- The type these functions can convert to and from.- Parameters:
type
- The class of type TtoString
- The bifunction to convert Objects of type T to Strings.fromString
- The bifunction to convert Strings to objects of type T.- See Also:
-
getTo
- Type Parameters:
T
- The type of Objects you wish to convert.- Parameters:
type
- The class of type T.- Returns:
- The bifunction to convert Objects of type T to Strings, registered with
registerConverters(Class, BiFunction, BiFunction)
. - See Also:
-
getFrom
- Type Parameters:
T
- The type of Objects you wish to convert to.- Parameters:
type
- The class of type T.- Returns:
- The bifunction to convert Strings to Objects of type T, registered with
registerConverters(Class, BiFunction, BiFunction)
. - See Also:
-
get
public static <T> Pair<BiFunction<T,DbCollection, getString>, BiFunction<String, DbCollection, T>> (Class<T> type) - Type Parameters:
T
- The type of Objects you wish to convert to and from.- Parameters:
type
- The class of type T.- Returns:
- A pair of both
getTo(Class)
andgetFrom(Class)
. - See Also:
-