AndroidParcelablePluginIntellij IDEA 安卓插件
AndroidParcelablePlugin 是为 Android Parcelable 提供的 Intellij IDEA(Android Studio) 插件。
实现 Parcelable 接口:
package com.wangjie.idea.plugin; public class Person{ private int id; private String name; private Float height; private Double weight; private Byte gender; private Boolean deleted; private Long birth; }
生成:
package com.wangjie.idea.plugin; import android.os.*; public class Person implements Parcelable { public static final Parcelable.Creator<Person> CREATOR = new Parcelable.Creator<Person>() { @Override public Person[] newArray(int size) { return new Person[size]; } @Override public Person createFromParcel(Parcel in) { return new Person(in); } }; private int id; private String name; private Float height; private Double weight; private Byte gender; private Boolean deleted; private Long birth; public Person(Parcel in) { id = in.readInt(); name = in.readString(); height = in.readFloat(); weight = in.readDouble(); gender = in.readByte(); deleted = 1 == in.readByte(); birth = in.readLong(); } @Override public void writeToParcel(Parcel out, int flags) { out.writeInt(id); out.writeString(name); out.writeFloat(height); out.writeDouble(weight); out.writeByte(gender); out.writeByte((byte) (deleted ? 1 : 0)); out.writeLong(birth); } @Override public int describeContents() { return 0; } }
评论