forked from pardom-zz/ActiveAndroid
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathView.java
More file actions
30 lines (24 loc) · 808 Bytes
/
View.java
File metadata and controls
30 lines (24 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package com.activeandroid;
import com.activeandroid.util.SQLiteUtils;
import java.util.List;
public abstract class View extends Model {
public abstract String getQuery();
@Override
public void delete() {
throw new RuntimeException("Cannot delete view row");
}
@Override
public Long save() {
throw new RuntimeException("Cannot save view row");
}
@SuppressWarnings("UnusedDeclaration")
public static <E extends View> List<E> getRows(Class<E> viewClass, String... params) {
String query;
try {
query = viewClass.newInstance().getQuery();
return SQLiteUtils.rawQuery(viewClass, query, params);
} catch (Exception e) {
throw new RuntimeException("Cannot create view row.", e);
}
}
}