I have the below object structure which extends ArrayList. When it is retrieved the List is null and so none of the values are stored within the microstream object graph. Not sure if this is either
- a bug
- unsupported feature
- A CustomHandler must be implemented
The code for creating the FooTable Object and toString results in
FooTable(super=TableListImpl(super=[a, b, c], tableNo=1, datatableNo=2), baz=baz)
FooTable foo = new FooTable(1,2);
foo.setBaz("baz");
foo.add("a");
foo.add("b");
foo.add("c");
System.out.println(foo1.toString());
Store FooTable in MicroStream. Stop/Start the app/DB and retrieve FooTable and the List is null. Interestingly when inspection the object variable 'size=3'. It appears microstream cannot see the fact this object extends List and only persists the other values ignoring the List.
Any advise on how to resolve this without changing the object structure.
Note: Lombok is being used here for brevity.
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString(callSuper = true)
public class FooTable extends TableListImpl<String> {
public FooTable(int tableNo, int datatableNo) {
super(tableNo, datatableNo);
}
private static final long serialVersionUID = 1L;
private String baz;
}
import java.util.ArrayList;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.ToString;
@RequiredArgsConstructor
@Getter
@ToString(callSuper = true)
public abstract class TableListImpl<E> extends ArrayList<E> implements TableList<E> {
private static final long serialVersionUID = 1L;
private final int tableNo;
private final int datatableNo;
}
import java.util.List;
public interface TableList<E> extends List<E>, Table {
}
public interface Table {
public int getTableNo();
public int getDatatableNo();
}