学习路径
- 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支持下项目哈。