學習路徑
- 1, 入門篇
- 2, 專題篇
- 3, 原始碼閱讀
陣列,列表,SparseArray的屬性。
- 就以之前的 模型 Student來舉例說明.
//age是陣列屬性
//name是list屬性
//id 是SparseArray屬性
@Fields( {
@Field(propName = "age" , type = int.class, complexType = COMPLEX_ARRAY),
@Field(propName = "name" , type = String.class, complexType = COMPLEX_LIST),
@Field(propName = "id" , type = long.class, complexType = COMPLEX_SPARSE_ARRAY),
})
public interface Student{}
複製程式碼
- 生成的模型程式碼:
@Fields( {
@Field(propName = "age" , type = int.class, complexType = COMPLEX_ARRAY),
@Field(propName = "name" , type = String.class, complexType = COMPLEX_LIST),
@Field(propName = "id" , type = long.class, complexType = COMPLEX_SPARSE_ARRAY),
})
public interface Student extends Serializable, Parcelable, DataPools.Poolable {
Property PROP_age = SharedProperties.get(int.class.getName(), "age", 1);
Property PROP_name = SharedProperties.get(String.class.getName(), "name", 2);
Property PROP_id = SharedProperties.get(long.class.getName(), "id", 3);
Student setAge(int[] age1);
int[] getAge();
Student setName(List<String> name1);
List<String> getName();
ListPropertyEditor<? extends Student, String> beginNameEditor();
Student setId(SparseArray<Long> id1);
SparseArray<Long> getId();
SparseArrayPropertyEditor<? extends Student, Long> beginIdEditor();
}
複製程式碼
下一章
想要體驗最新的特性 ?
請到github/data-mediator體驗。 如果覺得不錯,請star支援下專案哈。