java.lang.Object
io.helidon.dbclient.DbColumnBase
- Direct Known Subclasses:
MongoDbColumn
Base
DbColumn
implementation.-
Constructor Summary
ModifierConstructorDescriptionprotected
DbColumnBase
(Object value, MapperManager mapperManager, String... mappingQualifiers) Create a new instance. -
Method Summary
Modifier and TypeMethodDescription<N> Value
<N> as
(GenericType<N> type) Convert this value to a different type using a mapper.<N> Value
<N> Convert this value to a different type using a mapper.<N> Value
<N> Convert thisValue
to a different type using a mapper function.Boolean typed value.asDouble()
Double typed value.asInt()
Integer typed value.asLong()
Long typed value.Typed value asOptional
.asString()
String typed value.<T> T
get
(GenericType<T> type) Value of this column as a generic type.<T> T
Typed value of this column.protected <SRC,
T> T map
(SRC value, GenericType<T> type) Map value to target type usingMapper
.protected <SRC,
T> T Map value to target type usingMapper
.protected Object
rawValue()
Get raw value of the database column.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
DbColumnBase
Create a new instance.- Parameters:
value
- valuemapperManager
- mapper managermappingQualifiers
- mapping qualifiers
-
-
Method Details
-
rawValue
Get raw value of the database column.- Returns:
- raw value of the column
-
get
Description copied from interface:DbColumn
Typed value of this column. This method can return a correct result only if the type is the same asDbColumn.javaType()
or there is aMapper
registered that can map it.- Specified by:
get
in interfaceDbColumn
- Specified by:
get
in interfaceValue<Object>
- Type Parameters:
T
- type of the returned value- Parameters:
type
- class of the type that should be returned (must be supported by the underlying data type)- Returns:
- value of this column correctly typed
- Throws:
MapperException
- in case the type is not the underlyingDbColumn.javaType()
and there is no mapper registered for it
-
get
Description copied from interface:DbColumn
Value of this column as a generic type. This method can return a correct result only if the type represents a class, or if there is aMapper
registered that can map underlyingDbColumn.javaType()
to the type requested. -
as
Description copied from interface:Value
Convert this value to a different type using a mapper.- Specified by:
as
in interfaceValue<Object>
- Type Parameters:
N
- type we expect- Parameters:
type
- type to convert to- Returns:
- converted value
- Throws:
MapperException
- in case the value cannot be converted
-
as
Description copied from interface:Value
Convert this value to a different type using a mapper.- Specified by:
as
in interfaceValue<Object>
- Type Parameters:
N
- type we expect- Parameters:
type
- type to convert to- Returns:
- converted value
- Throws:
MapperException
-
as
Description copied from interface:Value
Convert thisValue
to a different type using a mapper function. -
asOptional
Description copied from interface:Value
Typed value asOptional
. Returns aempty
if this value does not have a backing value present. As this class implements all methods ofOptional
, this is only a utility method if an actualOptional
instance is needed (Optional
itself is {code final}).- Specified by:
asOptional
in interfaceValue<Object>
- Returns:
- value as
Optional
,empty
in case the value does not have a direct value - Throws:
MapperException
- in case the value cannot be converted to the expected type- See Also:
-
asBoolean
Description copied from interface:Value
Boolean typed value. -
asString
Description copied from interface:Value
String typed value. -
asInt
Description copied from interface:Value
Integer typed value. -
asLong
Description copied from interface:Value
Long typed value. -
asDouble
Description copied from interface:Value
Double typed value. -
map
Map value to target type usingMapper
.- Type Parameters:
SRC
- type of the source valueT
- type of the target value- Parameters:
value
- source valuetype
- target type- Returns:
- result of the mapping
- Throws:
MapperException
- in case the mapper was not found or failed
-
map
Map value to target type usingMapper
.String.valueOf(Object)
is used as fallback option whenMapper
fails.- Type Parameters:
SRC
- type of the source valueT
- type of the target value- Parameters:
value
- source valuetype
- target type- Returns:
- result of the mapping
-