I have an base class Peripheral
. Classes Sensor
and Master
are extensions of Peripheral
. I need ORMlite to instantiate my
Gray is correct, and I forgot about that reflection rule when I asked the question the first time. I have worked around the limitations on both limits of reflection and ORMlite not currently distiguishing between super classes. This is my structure:
class Peripheral {
@DatabaseField(generatedId)
int _ID;
@databaseField
int serial;
// ... Methods ommitted to be succint
}
class PeripheralWrapper extends Peripheral {
final Peripheral mBase;
PeripheralWrapper(Peripheral peripheral) {
mBase = peripheral;
}
// ... Methods are overridden but call the base's methods instead
}
class Sensor extends PeripheralWrapper {
Sensor(Peripheral peripheral) {
super(peripheral);
}
}
class Master extends PeripheralWrapper {
Master(Peripheral peripheral) {
super(peripheral);
}
}
// This is the work around
@DatabaseTable(tableName="Peripheral")
class BasePeripheral extends Peripheral {
}
This work around is simple actually. Now I only inflate the basePeripheral and then pass those into the wrappers as needed. All inflation and delegation of wrapping is done in a PeripheralFactory.