我正在android中学习SQLite。对于 SQLite,我推荐的是developer.android.com。但我在阅读代码时遇到了一些困惑。他们写FeedReaderContract构造函数来阻止
实例化FeedReaderContract类但他们没有定义FeedReaderContract任何地方的类以及之间的关系FeedReaderContract and FeedEntry.
public static abstract class FeedEntry implements BaseColumns
{
public static final String TABLE_NAME = "entry";
public static final String COLUMN_NAME_ENTRY_ID = "entryid";
public static final String COLUMN_NAME_TITLE = "title";
public static final String COLUMN_NAME_SUBTITLE = "subtitle";
...
}
为了防止有人意外实例化合约类,请给它一个空的构造函数。
//Prevents the FeedReaderContract class from being instantiated.
private FeedReaderContract() {}
我理解为:
public static class FeedReaderContract{
// Prevents the FeedReaderContract class from being instantiated.
private FeedReaderContract() {}
//The FeedEntry table definition
public static abstract class FeedEntry implements BaseColumns {
public static final String TABLE_NAME = "entry";
public static final String COLUMN_NAME_ENTRY_ID = "entryid";
public static final String COLUMN_NAME_TITLE = "title";
public static final String COLUMN_NAME_SUBTITLE = "subtitle";
...
}
//more tables definition
}