I have two classes and an interface (e.g. DatabaseModel
, LocalStore
and InternalModelInterface). They are defined as follows:
public class DatabaseModel {
The problem I am facing is that at runtime, when I call localStore.function()
, temp is set to null and InternalModelInterface.COLUMN_PARAM1
is null. Does this make sense? Should I evaluate InternalModelInterface.COLUMN_PARAM1
at compile time and embed it?
This is an Android app. Thanks in advance.
I will explain further to clarify any confusion.
DatabaseModel
objects are created when parsing a JSON response. The constants defined in the DatabaseModel
class are the keys to look for in the JSON response.
InternalModelInterface
defines the column names used in the local (cache) database on the device. For several reasons (including keys that are illegal column names in SQLite), I do not use keys as column names.
The reason I use the interface, and not just a simple class, is because the interface also specifies the necessary methods that must be implemented by the third LocalStore class.
1in9ui5t
source share