[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[nosql-dev] Polymorthism help needed.
|
Hi all,
Great to see that spec. and implementation is moving forward.
Especially that annotations are moving to the spec.:
org.eclipse.jnosql.mapping.Inheritance -> jakarta.nosql.Inheritance
Nevertheless, I have a trouble with custom inheritance with 1.1 using
ValueReader.
The implementation has changed (was Document and its an Element now).
Is there an elegant way to implement the inheritance when I have no
discriminator field?
public class MeasurementValueReader implements ValueReader {
@Override
public <T> T read(Class<T> clazz, Object value) {
if (List.class.isInstance(value)) {
final List list = List.class.cast(value);
if (list.stream().filter(Entry.class::isInstance)
.anyMatch(e -> "unit".equals(((Entry)e).name()))) {
return (QuantityEntity) ???;
}
}
How may I manually convert Object value into the concrete
(QuantityEntity) type (I catch the "Measurement" interface).
Thank you in advance,
Dmitry