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

com.appsingularity.postman.compiler.writers.fields.ParcelableFieldWriter Maven / Gradle / Ivy

There is a newer version: 1.1.1
Show newest version
package com.appsingularity.postman.compiler.writers.fields;

import android.support.annotation.NonNull;

import com.appsingularity.postman.compiler.writers.AbsCollectedFieldWriter;
import com.squareup.javapoet.MethodSpec;

import javax.lang.model.element.Element;

public class ParcelableFieldWriter extends AbsCollectedFieldWriter {

    public ParcelableFieldWriter(@NonNull Element element) {
        super(element);
    }

    @Override
    public void writeShipMethod(@NonNull MethodSpec.Builder shipMethod) {
        shipMethod.addStatement("dest.writeParcelable(source.$L, flags)", mElement.getSimpleName().toString());
    }

    @Override
    public void writeReceiveMethod(@NonNull MethodSpec.Builder receiveMethod) {
        receiveMethod.addStatement("target.$L = in.readParcelable($L.class.getClassLoader())"
                , mElement.getSimpleName().toString(), mElement.asType().toString());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy