Data-Mediator入门系列2-2

学习路径

数组,列表,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();
}
复制代码

下一章

Data-Mediator入门系列3

想要体验最新的特性 ?

请到github/data-mediator体验。 如果觉得不错,请star支持下项目哈。

欢迎大家star, fork,contribute ,提issue. 它会越来越棒。

Thanks for reading !

技术源于分享!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值