public interface SmartRow
Modifier and Type | Method and Description |
---|---|
default boolean |
contains(String name)
Checks if a given column is present and filled in the complete dataset
|
<T> boolean |
fillField(String name,
Function<sirius.kernel.commons.Value,T> valueExtractor,
Consumer<T> field,
T defaultValue)
Fills an object's field from the last
Value of a given column |
<T> boolean |
fillField(String name,
int n,
Function<sirius.kernel.commons.Value,T> valueExtractor,
Consumer<T> field,
T defaultValue)
Fills an object's field from the n-th
Value of a given column |
<T> boolean |
fillFieldIfPresent(String name,
Function<sirius.kernel.commons.Value,T> valueExtractor,
Consumer<T> field)
Fills an object's field from the last
Value of a given column, but only if the column
exists |
<T> boolean |
fillFieldIfPresent(String name,
int n,
Function<sirius.kernel.commons.Value,T> valueExtractor,
Consumer<T> field)
Fills an object's field from the n-th
Value of a given column, but only if the
column exists |
Collection<sirius.kernel.commons.Value> |
getAll()
Retrieves the complete row
|
List<sirius.kernel.commons.Value> |
getAll(String name)
Retrieves all
Value s under a given column name |
List<sirius.kernel.commons.Tuple<String,String>> |
getColumnMapping()
Returns
tuples of the original column names and their mapped column names. |
default sirius.kernel.commons.Value |
getFirst(String name)
Retrieves a
Value from this row |
sirius.kernel.commons.Value |
getFirstOrDefault(String name,
Object defaultValue)
Retrieves a
Value from this row |
default sirius.kernel.commons.Value |
getLast(String name)
Retrieves a
Value from this row |
sirius.kernel.commons.Value |
getLastOrDefault(String name,
Object defaultValue)
Retrieves a
Value from this row |
default sirius.kernel.commons.Value |
getNth(String name,
int n)
Retrieves a
Value from this row |
sirius.kernel.commons.Value |
getNthOrDefault(String name,
int n,
Object defaultValue)
Retrieves a
Value from this row |
default int |
size(String name)
Retrieves the number of columns with the given name
|
List<sirius.kernel.commons.Tuple<String,String>> getColumnMapping()
tuples
of the original column names and their mapped column names.@Nonnull Collection<sirius.kernel.commons.Value> getAll()
@Nonnull List<sirius.kernel.commons.Value> getAll(@Nonnull String name)
Value
s under a given column namename
- of the columndefault boolean contains(@Nonnull String name)
name
- of the columndefault int size(@Nonnull String name)
name
- of the column@Nonnull default sirius.kernel.commons.Value getFirst(@Nonnull String name)
Value
from this rowname
- of the column@Nonnull default sirius.kernel.commons.Value getNth(@Nonnull String name, int n)
Value
from this rowname
- of the columnn
- the index of the column@Nonnull default sirius.kernel.commons.Value getLast(@Nonnull String name)
Value
from this rowname
- of the column@Nonnull sirius.kernel.commons.Value getFirstOrDefault(@Nonnull String name, @Nullable Object defaultValue)
Value
from this rowname
- the name of the columndefaultValue
- returned if no column with the given name exists or the column contains an empty value@Nonnull sirius.kernel.commons.Value getNthOrDefault(@Nonnull String name, int n, @Nullable Object defaultValue)
Value
from this rowname
- of the columnn
- the index of the columndefaultValue
- returned if no column with the given name exists or the column contains an empty value@Nonnull sirius.kernel.commons.Value getLastOrDefault(@Nonnull String name, @Nullable Object defaultValue)
Value
from this rowname
- of the columndefaultValue
- returned if no column with the given name exists or the column contains an empty value<T> boolean fillFieldIfPresent(@Nonnull String name, @Nonnull Function<sirius.kernel.commons.Value,T> valueExtractor, @Nonnull Consumer<T> field)
Value
of a given column, but only if the column
existsT
- type of the field to be filledname
- of the columnvalueExtractor
- casts the Value
in this row to the target type of the fieldfield
- the field to be filled (or any other Consumer
)<T> boolean fillField(@Nonnull String name, @Nonnull Function<sirius.kernel.commons.Value,T> valueExtractor, @Nonnull Consumer<T> field, @Nullable T defaultValue)
Value
of a given columnT
- type of the field to be filledname
- of the columnvalueExtractor
- casts the Value
in this row to the target type of the fieldfield
- the field to be filled (or any other Consumer
)defaultValue
- will be used instead if the column does not exist<T> boolean fillFieldIfPresent(@Nonnull String name, int n, @Nonnull Function<sirius.kernel.commons.Value,T> valueExtractor, @Nonnull Consumer<T> field)
Value
of a given column, but only if the
column existsT
- type of the field to be filledname
- of the columnn
- the index of the columnvalueExtractor
- casts the Value
in this row to the target type of the fieldfield
- the field to be filled (or any other Consumer
)<T> boolean fillField(@Nonnull String name, int n, @Nonnull Function<sirius.kernel.commons.Value,T> valueExtractor, @Nonnull Consumer<T> field, @Nullable T defaultValue)
Value
of a given columnT
- type of the field to be filledname
- of the columnn
- the index of the columnvalueExtractor
- casts the Value
in this row to the target type of the fieldfield
- the field to be filled (or any other Consumer
)defaultValue
- will be used instead if the column does not existCopyright © 2018. All rights reserved.