下面列出了android.os.Parcel#readValue ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@SuppressWarnings({
"unchecked"
})
public Result createFromParcel(Parcel in) {
Result instance = new Result();
instance.id = ((String) in.readValue((String.class.getClassLoader())));
instance.createdAt = ((String) in.readValue((String.class.getClassLoader())));
instance.updatedAt = ((String) in.readValue((String.class.getClassLoader())));
instance.width = ((Integer) in.readValue((Integer.class.getClassLoader())));
instance.height = ((Integer) in.readValue((Integer.class.getClassLoader())));
instance.color = ((String) in.readValue((String.class.getClassLoader())));
instance.likes = ((Integer) in.readValue((Integer.class.getClassLoader())));
instance.likedByUser = ((Boolean) in.readValue((Boolean.class.getClassLoader())));
instance.user = ((User) in.readValue((User.class.getClassLoader())));
in.readList(instance.currentUserCollections, (java.lang.Object.class.getClassLoader()));
instance.urls = ((Urls) in.readValue((Urls.class.getClassLoader())));
in.readList(instance.categories, (Category.class.getClassLoader()));
instance.links = ((Links) in.readValue((Links.class.getClassLoader())));
return instance;
}
FormatTest(Parcel in) {
integer = (Integer)in.readValue(null);
int32 = (Integer)in.readValue(null);
int64 = (Long)in.readValue(null);
number = (BigDecimal)in.readValue(BigDecimal.class.getClassLoader());
_float = (Float)in.readValue(null);
_double = (Double)in.readValue(null);
string = (String)in.readValue(null);
_byte = (byte[])in.readValue(null);
binary = (File)in.readValue(File.class.getClassLoader());
date = (LocalDate)in.readValue(LocalDate.class.getClassLoader());
dateTime = (OffsetDateTime)in.readValue(OffsetDateTime.class.getClassLoader());
uuid = (UUID)in.readValue(UUID.class.getClassLoader());
password = (String)in.readValue(null);
bigDecimal = (BigDecimal)in.readValue(BigDecimal.class.getClassLoader());
}
protected Department(Parcel in) {
super(in);
this.mName = in.readString();
this.mIsActive = (Boolean) in.readValue(Boolean.class.getClassLoader());
this.mParentID = in.readLong();
this.mOrderNum = in.readInt();
this.mExpanded = in.readByte() != 0;
}
/**
* Constructor called from {@link #CREATOR}
*/
private SavedState(Parcel in) {
super(in);
mSerializedPattern = in.readString();
mDisplayMode = in.readInt();
mInputEnabled = (Boolean) in.readValue(null);
mInStealthMode = (Boolean) in.readValue(null);
mTactileFeedbackEnabled = (Boolean) in.readValue(null);
}
protected Artist(Parcel in) {
super(in);
this.followers = in.readParcelable(Followers.class.getClassLoader());
this.genres = in.createStringArrayList();
this.images = in.createTypedArrayList(Image.CREATOR);
this.popularity = (Integer) in.readValue(Integer.class.getClassLoader());
}
private Attachment(Parcel in) {
this.id = (Long) in.readValue(Long.class.getClassLoader());
this.url = in.readString();
this.thumbnailUrl = in.readString();
this.size = (Long) in.readValue(Long.class.getClassLoader());
this.contentType = in.readString();
this.viewsCount = (Integer) in.readValue(Integer.class.getClassLoader());
long tmpCreatedAt = in.readLong();
this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt);
}
/**
* Constructor called from {@link #CREATOR}
*/
@SuppressLint("ParcelClassLoader")
private SavedState(Parcel in) {
super(in);
mSerializedPattern = in.readString();
mDisplayMode = in.readInt();
mInputEnabled = (Boolean) in.readValue(null);
mInStealthMode = (Boolean) in.readValue(null);
mTactileFeedbackEnabled = (Boolean) in.readValue(null);
}
protected PlaylistBase(Parcel in) {
this.collaborative = (Boolean) in.readValue(Boolean.class.getClassLoader());
this.external_urls = in.readHashMap(Map.class.getClassLoader());
this.href = (String) in.readValue(String.class.getClassLoader());
this.id = (String) in.readValue(String.class.getClassLoader());
this.images = in.createTypedArrayList(Image.CREATOR);
this.name = (String) in.readValue(String.class.getClassLoader());
this.owner = in.readParcelable(UserPublic.class.getClassLoader());
this.is_public = (Boolean) in.readValue(Boolean.class.getClassLoader());
this.snapshot_id = (String) in.readValue(String.class.getClassLoader());
this.type = (String) in.readValue(String.class.getClassLoader());
this.uri = (String) in.readValue(String.class.getClassLoader());
}
@SuppressWarnings({
"unchecked"
})
public CoolDetailsResponse createFromParcel(Parcel in) {
CoolDetailsResponse instance = new CoolDetailsResponse();
instance.hash = ((String) in.readValue((String.class.getClassLoader())));
instance.addr = ((String) in.readValue((String.class.getClassLoader())));
instance.bund = ((String) in.readValue((String.class.getClassLoader())));
return instance;
}
protected Builder(Parcel in) {
mStyleId = in.readInt();
mContentViewId = in.readInt();
mTitle = (CharSequence) in.readValue(null);
mPositive = (CharSequence) in.readValue(null);
mNegative = (CharSequence) in.readValue(null);
mNeutral = (CharSequence) in.readValue(null);
onReadFromParcel(in);
}
@SuppressWarnings({
"unchecked"
})
public Data createFromParcel(Parcel in) {
Data instance = new Data();
instance.timestamp = ((Long) in.readValue((Integer.class.getClassLoader())));
instance.value = ((String) in.readValue((String.class.getClassLoader())));
instance.tags = ((Tags) in.readValue((Tags.class.getClassLoader())));
return instance;
}
TypeHolderExample(Parcel in) {
stringItem = (String)in.readValue(null);
numberItem = (BigDecimal)in.readValue(BigDecimal.class.getClassLoader());
floatItem = (Float)in.readValue(null);
integerItem = (Integer)in.readValue(null);
boolItem = (Boolean)in.readValue(null);
arrayItem = (List<Integer>)in.readValue(null);
}
private WrappedPlace(Parcel parcel) {
placeClass = (Class<T>) parcel.readSerializable();
dataClass = (Class) parcel.readSerializable();
if (Void.class.equals(dataClass)) {
data = parcel.readValue(String.class.getClassLoader());
} else if (Parcelable.class.isAssignableFrom(dataClass)) {
data = parcel.readParcelable(dataClass.getClassLoader());
} else if (Serializable.class.isAssignableFrom(dataClass)) {
data = parcel.readSerializable();
} else {
throw new RuntimeException(String.format("Error restoring place %s", placeClass));
}
}
protected NestedModelFilter(Parcel in) {
this.mIdList = (HashSet<Long>) in.readSerializable();
this.mEnabled = (Boolean) in.readValue(Boolean.class.getClassLoader());
this.mModelType = in.readInt();
this.mInverted = in.readByte() != 0;
this.mIncludeChildren = in.readByte() != 0;
this.mId = in.readLong();
}
/**
* Iterates over the map looking for the {@link #BUNDLE_KEY_CALLBACK} key to try and read the {@link IBinder}
* straight from the parcelled data. This is entirely dependent on the implementation of Parcel, but these specific
* parts of {@link Parcel} / {@link Bundle} haven't changed since 2008 and newer versions of Android will ship
* with newer versions of Google Play services which embed the IBinder directly into the {@link Bundle}
* (no need to deal with the {@link android.os.Parcelable} issues).
*/
GcmIntentParser(Bundle data) throws RuntimeException {
if (data == null) {
throw new IllegalArgumentException();
}
jobId = Integer.valueOf(data.getString(BUNDLE_KEY_TAG));
extras = data.getBundle(BUNDLE_KEY_EXTRAS);
triggeredContentUris = data.getParcelableArrayList(BUNDLE_KEY_TRIGGERED_URIS);
if (triggeredContentUris != null) {
triggeredContentAuthorities = new ArrayList<>();
for (Uri triggeredContentUri : triggeredContentUris) {
triggeredContentAuthorities.add(triggeredContentUri.getAuthority());
}
}
Parcel parcel = toParcel(data);
try {
int numEntries = checkNonEmptyBundleHeader(parcel);
for (int i = 0; i < numEntries; i++) {
String key = null;
if (shouldReadKeysAsStrings()) {
key = parcel.readString();
} else {
Object entryKeyObj = parcel.readValue(getClass().getClassLoader());
if (entryKeyObj instanceof String) {
key = (String) entryKeyObj;
}
}
if (key == null) {
continue;
}
if (BUNDLE_KEY_CALLBACK.equals(key)
&& parcel.readInt() == VAL_PARCELABLE
&& PENDING_CALLBACK_CLASS.equals(parcel.readString())) {
callback = parcel.readStrongBinder();
break;
}
}
} finally {
parcel.recycle();
}
if (extras == null || callback == null) {
throw new IllegalArgumentException();
}
}
EnumArrays(Parcel in) {
justSymbol = (JustSymbolEnum)in.readValue(null);
arrayEnum = (List<ArrayEnumEnum>)in.readValue(null);
}
protected MovieInterest(Parcel in) {
this.id = (Long) in.readValue(Long.class.getClassLoader());
this.movie = in.readParcelable(Movie.class.getClassLoader());
this.user = in.readParcelable(User.class.getClassLoader());
}
ArrayOfArrayOfNumberOnly(Parcel in) {
arrayArrayNumber = (List<List<BigDecimal>>)in.readValue(List.class.getClassLoader());
}
CatAllOf(Parcel in) {
declawed = (Boolean)in.readValue(null);
}
public FaceAnalysis(Parcel in) {
faceRectangle = (FaceRectangle) in.readValue(FaceRectangle.class.getClassLoader());
scores = (Scores) in.readValue(Scores.class.getClassLoader());
}