All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.workday.postman.adapter.BigIntegerParcelableAdapter Maven / Gradle / Ivy

Go to download

A java library that uses code generation to handle the details of implementing the Parcelable interface on Android.

There is a newer version: 1.3
Show newest version
/*
 * 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;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy