com.workday.postman.adapter.BigIntegerParcelableAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of postman Show documentation
Show all versions of postman Show documentation
A java library that uses code generation to handle the details of implementing the Parcelable interface on Android.
/*
* Copyright 2015 Workday, Inc.
*
* This software is available under the MIT license.
* Please see the LICENSE.txt file in this project.
*/
package com.workday.postman.adapter;
import android.os.Parcel;
import java.math.BigInteger;
/**
* @author Nathan Taylor
* @since 2015-04-26
*/
public class BigIntegerParcelableAdapter implements ParcelableAdapter {
private final BigInteger value;
public BigIntegerParcelableAdapter(BigInteger value) {
this.value = value;
}
public static final Creator CREATOR =
new Creator() {
@Override
public BigIntegerParcelableAdapter createFromParcel(Parcel source) {
return new BigIntegerParcelableAdapter(new BigInteger(source.readString()));
}
@Override
public BigIntegerParcelableAdapter[] newArray(int size) {
return new BigIntegerParcelableAdapter[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(value.toString());
}
@Override
public BigInteger getValue() {
return value;
}
}