|
| 1 | +package cn.com.videopls.pub; |
| 2 | + |
| 3 | +import android.os.Parcel; |
| 4 | +import android.os.Parcelable; |
| 5 | +import android.text.TextUtils; |
| 6 | + |
| 7 | +import org.luaj.vm2.ast.Str; |
| 8 | + |
| 9 | +/** |
| 10 | + * Created by yanjiangbo on 2017/5/16. |
| 11 | + */ |
| 12 | + |
| 13 | +public class LuaUpdateInfo implements Parcelable { |
| 14 | + |
| 15 | + private final String mVersion; |
| 16 | + private final String mDownloadUrl; |
| 17 | + private final String mManifestJson; |
| 18 | + private LuaUpdateInfo(Builder builder) { |
| 19 | + this.mVersion = builder.mVersion; |
| 20 | + this.mDownloadUrl = builder.mDownloadUrl; |
| 21 | + this.mManifestJson=builder.mManifestJson; |
| 22 | + } |
| 23 | + |
| 24 | + public String getDownloadUrl() { |
| 25 | + return mDownloadUrl; |
| 26 | + } |
| 27 | + |
| 28 | + public String getVersion() { |
| 29 | + return mVersion; |
| 30 | + } |
| 31 | + |
| 32 | + public String getManifestJson() { |
| 33 | + return mManifestJson; |
| 34 | + } |
| 35 | + |
| 36 | + public static class Builder { |
| 37 | + private String mVersion; |
| 38 | + private String mDownloadUrl; |
| 39 | + private String mManifestJson; |
| 40 | + |
| 41 | + public Builder setVersion(String version) { |
| 42 | + if (!TextUtils.isEmpty(version)) { |
| 43 | + this.mVersion = version; |
| 44 | + } |
| 45 | + return this; |
| 46 | + } |
| 47 | + |
| 48 | + public Builder setDownloadUrl(String downloadUrl) { |
| 49 | + if (!TextUtils.isEmpty(downloadUrl)) { |
| 50 | + this.mDownloadUrl = downloadUrl; |
| 51 | + } |
| 52 | + return this; |
| 53 | + } |
| 54 | + public Builder setManifestJson(String manifestJson) { |
| 55 | + if (!TextUtils.isEmpty(manifestJson)) { |
| 56 | + this.mManifestJson = manifestJson; |
| 57 | + } |
| 58 | + return this; |
| 59 | + } |
| 60 | + |
| 61 | + public LuaUpdateInfo build() { |
| 62 | + return new LuaUpdateInfo(this); |
| 63 | + } |
| 64 | + |
| 65 | + } |
| 66 | + |
| 67 | + @Override |
| 68 | + public int describeContents() { |
| 69 | + return 0; |
| 70 | + } |
| 71 | + |
| 72 | + @Override |
| 73 | + public void writeToParcel(Parcel dest, int flags) { |
| 74 | + dest.writeString(this.mVersion); |
| 75 | + dest.writeString(this.mDownloadUrl); |
| 76 | + dest.writeString(this.mManifestJson); |
| 77 | + } |
| 78 | + |
| 79 | + protected LuaUpdateInfo(Parcel in) { |
| 80 | + this.mVersion = in.readString(); |
| 81 | + this.mDownloadUrl = in.readString(); |
| 82 | + this.mManifestJson=in.readString(); |
| 83 | + } |
| 84 | + |
| 85 | + public static final Parcelable.Creator<LuaUpdateInfo> CREATOR = new Parcelable.Creator<LuaUpdateInfo>() { |
| 86 | + @Override |
| 87 | + public LuaUpdateInfo createFromParcel(Parcel source) { |
| 88 | + return new LuaUpdateInfo(source); |
| 89 | + } |
| 90 | + |
| 91 | + @Override |
| 92 | + public LuaUpdateInfo[] newArray(int size) { |
| 93 | + return new LuaUpdateInfo[size]; |
| 94 | + } |
| 95 | + }; |
| 96 | + |
| 97 | + @Override |
| 98 | + public int hashCode() { |
| 99 | + return TextUtils.isEmpty(mVersion) ? super.hashCode() : mVersion.hashCode(); |
| 100 | + } |
| 101 | + |
| 102 | + @Override |
| 103 | + public boolean equals(Object obj) { |
| 104 | + if (obj == null) { |
| 105 | + return super.equals(obj); |
| 106 | + } |
| 107 | + if (!(obj instanceof ServiceQueryAdsInfo)) { |
| 108 | + return super.equals(obj); |
| 109 | + } |
| 110 | + LuaUpdateInfo luaUpdateInfo = (LuaUpdateInfo) obj; |
| 111 | + return TextUtils.equals(mVersion, luaUpdateInfo.getVersion()); |
| 112 | + } |
| 113 | +} |
0 commit comments