GithubHelp home page GithubHelp logo

mcharmas / android-parcelable-intellij-plugin Goto Github PK

View Code? Open in Web Editor NEW
2.1K 2.1K 214.0 691 KB

IntelliJ Plugin for Android Parcelable boilerplate code generation.

License: Apache License 2.0

Java 100.00%

android-parcelable-intellij-plugin's People

Contributors

brentwatson avatar dallasgutauckis avatar esteluk avatar gbogarinb avatar googolmo avatar josegonzalez avatar mcharmas avatar psyren89 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-parcelable-intellij-plugin's Issues

Generator doesn´t work

Your plugin doesn´t work with my IntelliJ Setup

8:53:31 PM PluginException: pl/charmas/parcelablegenerator/ParcelableAction : Unsupported major.minor version 51.0 [Plugin: pl.charmas.parcelablegenerator]: pl/charmas/parcelablegenerator/ParcelableAction : Unsupported major.minor version 51.0 [Plugin: pl.charmas.parcelablegenerator]

I´m using the latest intelliJ:
Screen Shot 2013-02-27 at 8 59 13 PM

Proper List support

Right now, List support assumes ArrayList. Would be nice to have custom List support for different types of lists. We'd have to do some things (such as checking to see if the field is initialized in declaration) to determine if we can use the field or if we should create a temporary local variable for assignment.

Issues with List of Parcelables

I am having issues with List support. I keep getting NullPointers when I try to read my object. Below is the objects involed:

Root object I am trying to parcel

public class MyObjectToStore implements Parcelable {
    public List<ObjectInList> objectsInList;
    public String myObjectValue;

    public MyObjectToStore() {
    }

    private MyObjectToStore(Parcel in) {
        in.readTypedList(objectsInList, ObjectInList.CREATOR);
        this.myObjectValue = in.readString();
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeTypedList(objectsInList);
        dest.writeString(this.myObjectValue);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<MyObjectToStore> CREATOR = new Creator<MyObjectToStore>() {
        public MyObjectToStore createFromParcel(Parcel source) {
            return new MyObjectToStore(source);
        }

        public MyObjectToStore[] newArray(int size) {
            return new MyObjectToStore[size];
        }
    };
}

Inner Parcelable in list

public class ObjectInList implements Parcelable {
    String objectInListValue;

    private ObjectInList(Parcel in) {
        this.objectInListValue = in.readString();
    }

    public ObjectInList(String objectInListValue) {
        this.objectInListValue = objectInListValue;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.objectInListValue);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<ObjectInList> CREATOR = new Creator<ObjectInList>() {
        public ObjectInList createFromParcel(Parcel source) {
            return new ObjectInList(source);
        }

        public ObjectInList[] newArray(int size) {
            return new ObjectInList[size];
        }
    };
}

Test that shows Exception

public class MyObjectToStoreTest extends TestCase {

    public void testParcelable() {
        MyObjectToStore objectToStore = new MyObjectToStore();
        objectToStore.myObjectValue = "MyObjectValue";
        List<ObjectInList> list = new ArrayList<ObjectInList>();
        list.add(new ObjectInList("Object1"));
        list.add(new ObjectInList("Object2"));
        objectToStore.objectsInList = list;

        Parcel parcel = Parcel.obtain();
        objectToStore.writeToParcel(parcel, 0);
        parcel.setDataPosition(0);

        MyObjectToStore fromParcel = MyObjectToStore.CREATOR.createFromParcel(parcel);
        assertEquals("MyObjectValue", fromParcel.myObjectValue);
        assertEquals(2, fromParcel.objectsInList.size());
        assertEquals("Object1", fromParcel.objectsInList.get(0).objectInListValue);
        assertEquals("Object2", fromParcel.objectsInList.get(1).objectInListValue);
    }
}

Exception

java.lang.NullPointerException
at android.os.Parcel.readTypedList(Parcel.java:1797)
at objects.MyObjectToStore.<init>(MyObjectToStore.java:27)
at objects.MyObjectToStore.<init>(MyObjectToStore.java:8)
at objects.MyObjectToStore$1.createFromParcel(MyObjectToStore.java:33)
at objects.MyObjectToStore$1.createFromParcel(MyObjectToStore.java:31)
at objects.MyObjectToStoreTest.testParcelable(MyObjectToStoreTest.java:24)

It seems to blow up because the list in MyObjectToStore is not being initialized properly by the generated code in private MyObjectToStore(Parcel in). Shouldn't that constructor generate something like

private MyObjectToStore(Parcel in) {
    objectsInList = new ArrayList<ObjectInList>(); // new
    in.readTypedList(objectsInList, ObjectInList.CREATOR);
    this.myObjectValue = in.readString();
}

Am I missing something? Is this an unimplemented feature, a bug, or a compromise because the code generator doesn't know what Type of list it is?

Add SuppressWarning annotation for non-param constructor

Thank you very much for this nice plugin!
In my opinion, the non param constructor for the generated class is necessary but the compiler maybe not able to detect this, so could we add SuppressWarning("unused") for the constructor? Thanks again for reading this issue.

Add support for type Map

While it is already in the TODO list i wanted to raise my voice and mentioned that Map support would be really great. :)

Generate code with parent object from library

when generate code with extend object from library, this error occur:
Plugin Error: Android Parcelable code generator threw an uncaught IncorrectOperationException. Disable Plugin
IncorrectOperationException: Cannot modify compiled element in file 'C:\Users\Mx\IdeaProjects\durra-projects\Pharmacy2\app\build\intermediates\exploded-aar\org.bitbucket.mxninja\library\1.17.9\jars\classes.jar!\com\najjar\android\lib\objects\MasterJson.class'

i use the option, (include field from base class) the same error occur.

Can't generate Parcelable for fields in child classes

After upgraded to latest version 0.6.3, it seems I can no longer generate Parcelable in child classes regardless of what accessors those fields have.

For example:

public class Person {
    String name;
}

public class Employee extends Person {
    String company;
}

The Employee class can only generate Parcelable for its own fields, company but not name. It might make sense. But what if the parent class doesn't implement Parcelable at all and I only want child classes to implement Parcelable?

Is this a design change?

Should describeContents return hashCode instead of 0?

Hello all,

I am sure there is a reason for this, but describeContents returns 0, why not return hashCode() instead?

Neither implementation is that helpful, but I would say hashCode() is better than 0.

What do you guys think?

Checkstyle issue

Hello

i'm checking my project with checkstyle to find code related issues. It is warning me about this

public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
public ComplaintData createFromParcel( Parcel source ) {return new ComplaintData(source);}
public ComplaintData[] newArray( int size ) {return new ComplaintData[size];}
};

with the following messages:

'return' is not preceded with whitespace.
'{' is not followed by whitespace.
';' is not followed by whitespace.
'}' is not preceded with whitespace.

Is it possible to fix this issues in the plugin ?

Thanks a lot

Issue with List<String>

In release 0.6.1 generation for fields like private List<String> names; results in something like this:

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeList(this.names);
    }

    private Contact(Parcel in) {
        this.names = new ArrayList<List<String>>();
        in.readList(this.names, List<String>.class.getClassLoader());
    }

Which, obviously, does not compile. :)
I suggest that for lists of strings you should use writeStringList() and readStringList(), for example:

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeStringList(this.names);
    }

    private Contact(Parcel in) {
        this.names = new ArrayList<String>();
        in.readStringList(this.names);
    }

Support for inheritance.

When implementing parcelable by class that already inherits from another parcelable, the super(Parcel in) constructor should be called and super.writeToParcel(Parcel desc, int flags).

short[] causes broken code

I already read in the readme.md that you don't support that type, but the generated code does not compile. If you have some time please fix that.

Request: support Kotlin too

Maybe use the "Parcelable support" of "Android Extensions plugin" :

https://blog.jetbrains.com/kotlin/2017/08/kotlin-1-1-4-is-out/

It could be great. Your plugin could just use it, and work as a nice UI to generate its code, choosing which fields to be stored&restored, and which not, and in which order, etc...

An example of usage, using this feature:

Gradle file :

apply plugin: 'org.jetbrains.kotlin.android.extensions'
androidExtensions {
experimental = true
}

sample code of a class with 3 Dates in it:

@SuppressLint("ParcelCreator")
@Parcelize
class MonthItem(val today: Date, val startDate: Date, val endDate: Date) : Parcelable {
}

Object is not parceled correctly if it has a field of an array of its own type

Consider this example class:

public class Example {
    private Example[] array;
}

After generating the parcelable code, we get:

public class Example implements Parcelable {

    private Example[] array;


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeParcelable(this.array, flags);
    }

    public Example() {
    }

    protected Example(Parcel in) {
        this.array = in.readParcelable(Example[].class.getClassLoader());
    }

    public static final Parcelable.Creator<Example> CREATOR = new Parcelable.Creator<Example>() {
        @Override
        public Example createFromParcel(Parcel source) {
            return new Example(source);
        }

        @Override
        public Example[] newArray(int size) {
            return new Example[size];
        }
    };
}

writeParcelable should be writeTypedArray
readParcelable should be createTypedArray

This issue seams to be in ParcelableSerializerFactory.getSerializer() where the psiType of the class we're currently working on has not yet implemented the Parcelable interface.

Suggested improvements

Hi,
I have couple of improvements to take into account:
Possibility of adding custom generation templates (similar to Live Templates), e.g.
when we have field: Integer field; plugin could generate pair:
field= CustomUtil.read(parcel);
CustomUtil.write(field,parcel);

Possibility to generate custom CREATOR

runtime exception when readList

i found a bug:

protected AAA(Parcel in) {
this.myList = new ArrayList();
in.readList(this.myList, List.class.getClassLoader());
}

should be:

protected AAA(Parcel in) {
this.myList = new ArrayList();
in.readList(this.myList, BBB.class.getClassLoader());
}

hy there

dude take care of the chars just set them like ints and in unmarshall cast to char

;)

Alt + Insert

What if you don't have an insert key? I'm running on a Macbook Air.

Nested support

Thanks for your plugin, it save us tons of work! But I found that, if I put an instance into an instance of the same type, like below:

public class A {
private int mInt;
@nullable private A mA;
}

and I have to apply this plugin twice to make it correct. Sometime someone forgot to apply it twice and make it crash or compile fail.

Code formating

It destroys code formating. Dosent obey formatting on off options.

Any plans on supporting type adapters?

Type adapters would be great for serializing objects that only implement Serializable or nothing at all. Right now, the library generates dest.writeSerializable(this.foo); for Joda DateTime, where using writeLong would be much more efficient. I have no idea how this would plug into the library, though.

Issue with java.util.Date

Hello,
when implementing Parcelable to a class wich contains fields of type java.ultil.Date,
android-parcelable-intellij-plugin creates the method 'private MyClass(Parcel in)' with an error:
The type(s) in this method are Date and not java.util.Date
Version: 0.6.1

NullPointerException: null

I got this

null
java.lang.NullPointerException
    at pl.charmas.parcelablegenerator.util.PsiUtils.isOfType(PsiUtils.java:42)
    at pl.charmas.parcelablegenerator.typeserializers.ParcelableSerializerFactory.getSerializer(ParcelableSerializerFactory.java:35)
    at pl.charmas.parcelablegenerator.typeserializers.ChainSerializerFactory.getSerializer(ChainSerializerFactory.java:35)
    at pl.charmas.parcelablegenerator.CodeGenerator.getSerializerForType(CodeGenerator.java:131)
    at pl.charmas.parcelablegenerator.CodeGenerator.generateWriteToParcel(CodeGenerator.java:107)
    at pl.charmas.parcelablegenerator.CodeGenerator.generate(CodeGenerator.java:146)
    at pl.charmas.parcelablegenerator.ParcelableAction$1.run(ParcelableAction.java:50)
    at com.intellij.openapi.command.WriteCommandAction$Simple.run(WriteCommandAction.java:166)
    at com.intellij.openapi.application.RunResult.run(RunResult.java:35)
    at com.intellij.openapi.command.WriteCommandAction$2$1.run(WriteCommandAction.java:114)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1010)
    at com.intellij.openapi.command.WriteCommandAction$2.run(WriteCommandAction.java:111)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:124)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:99)
    at com.intellij.openapi.command.WriteCommandAction.performWriteCommandAction(WriteCommandAction.java:108)
    at com.intellij.openapi.command.WriteCommandAction.execute(WriteCommandAction.java:80)
    at pl.charmas.parcelablegenerator.ParcelableAction.generateParcelable(ParcelableAction.java:47)
    at pl.charmas.parcelablegenerator.ParcelableAction.actionPerformed(ParcelableAction.java:42)
    at com.intellij.ui.popup.PopupFactoryImpl$ActionPopupStep.performAction(PopupFactoryImpl.java:856)
    at com.intellij.ui.popup.PopupFactoryImpl$ActionPopupStep$1.run(PopupFactoryImpl.java:842)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:866)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:654)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:381)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

when i try use plugin for my class

public abstract class SimpleAdapter<T> extends BaseAdapter implements Parcelable {
    public List<T> items;
    public Context context;

    public SimpleAdapter(List<T> items, Context context) {
        this.items = items;
        this.context = context;
    }

    @Override
    public int getCount() {
        return items.size();
    }

    @Override
    public Object getItem(int position) {
        return items.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    public View generateView(int viewId, ViewGroup parent){
        LayoutInflater inflater = LayoutInflater.from(context);
        View view = inflater.inflate(viewId, parent, false);

        return view;
    }


}

Where I mistake?

constructor issue

The default constructor gets overwritten with a private one.
Now you have the problem if you make an existing class parcelable that you need to add an empty constructor, otherwise you'll get many errors because the default one doesn't exist any more.

Also ArrayLists don't work, had to implement the write and read myself.

But anyway, good job with the plugin! :)

best regards

Error writing a list of Parcelable objects with subclasses

When I need to save a list of parcelable objects whose type has been subclassed, it doesn't save the members of the subclass.

class A {
  ArrayList<B> list;
  ...
}

class B {
  ...
}

class C extends B {
  // members in addition to members of class B that should be saved when saving list
}

This causes a difficult to trace RunTimeException when unparcelling the list. The RTE is something like

java.lang.RuntimeException: Parcel android.os.Parcel@XXX: Unmarshalling unknown type code YYY at offset ZZZ}

This happens because of the writeTypedArrayList method. I fixed the error by replacing this method with writeList and the readTypedArrayList method with readList as well.

Here is a larger writeup done by someone who experienced this same scenario without the plugin
https://medium.com/@kcoppock/writing-parcelable-lists-with-inheritance-a739c42c055c

Not properly inflating ParcelableExtras

When mEventDetail is an instance of the class EventDetail, generated for for inflation is

    private BasketState(Parcel in) {
        this.mEventDetail = in.readParcelable(((Object) mEventDetail).getClass().getClassLoader());
        ...

mEventDetail isn't initialized at this point so mEventDetail.getClass() is null and inflation fails. It needs to be

    private BasketState(Parcel in) {
        this.mEventDetail = in.readParcelable(EventDetail.class.getClassLoader());

Not showing up in Android Studio 0.8.1

Hi,

I have installed the plugin and the Parcelable menu item is not showing up when I press alt+insert inside a class. That looked promising though. Looking forward to it.

Android Studio 0.8.1 on Windows 7 64bits

[Question] Why the generated constructor is protected rather than private?

I'm a long-time user of this plugin for Android Studio. Great job!

Just a small question - in the official Android Documentation, the example of how the Parcelable interface should be used is slightly different than the generated code by your plugin.

In the official example, the POJO's constructor is private, while the one generated by your plugin is protected. Is there any specific reason for this?

Links:
Official Parcelable documentation
POJO with Parcelable code generated by your plugin

Parcelable[] instead of Parcelable

There is a bug in the code generation of Parcelables. I'm using an array of Parcelables as attribute and it's writing:

@Override public void writeToParcel(Parcel dest, int flags) {
    dest.writeParcelable(this.overlayImages, flags);
}
private InGameInfoBundle(Parcel in) {
    this.overlayImages = in.readParcelable(OverlayImage[].class.getClassLoader());
}

instead of

@Override public void writeToParcel(Parcel dest, int flags) {
    dest.writeParcelableArray(this.overlayImages, flags);
}
private InGameInfoBundle(Parcel in) {
    this.overlayImages = (OverlayImage[]) in.readParcelableArray(OverlayImage.class.getClassLoader());
}

Thx!!

NPE in Android Studio 1.2.1

Doesn't work in Android Studio 1.2.1

null
java.lang.NullPointerException
    at pl.charmas.parcelablegenerator.util.PsiUtils.isOfType(PsiUtils.java:77)
    at pl.charmas.parcelablegenerator.typeserializers.ListSerializerFactory.getSerializer(ListSerializerFactory.java:27)
    at pl.charmas.parcelablegenerator.typeserializers.ChainSerializerFactory.getSerializer(ChainSerializerFactory.java:35)
    at pl.charmas.parcelablegenerator.CodeGenerator.getSerializerForType(CodeGenerator.java:96)
    at pl.charmas.parcelablegenerator.CodeGenerator.generateWriteToParcel(CodeGenerator.java:87)
    at pl.charmas.parcelablegenerator.CodeGenerator.generate(CodeGenerator.java:111)
    at pl.charmas.parcelablegenerator.ParcelableAction$1.run(ParcelableAction.java:50)
    at com.intellij.openapi.command.WriteCommandAction$Simple.run(WriteCommandAction.java:166)
    at com.intellij.openapi.application.RunResult.run(RunResult.java:38)
    at com.intellij.openapi.command.WriteCommandAction$2$1.run(WriteCommandAction.java:114)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:937)
    at com.intellij.openapi.command.WriteCommandAction$2.run(WriteCommandAction.java:111)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:124)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:99)
    at com.intellij.openapi.command.WriteCommandAction.performWriteCommandAction(WriteCommandAction.java:108)
    at com.intellij.openapi.command.WriteCommandAction.execute(WriteCommandAction.java:80)
    at pl.charmas.parcelablegenerator.ParcelableAction.generateParcelable(ParcelableAction.java:47)
    at pl.charmas.parcelablegenerator.ParcelableAction.actionPerformed(ParcelableAction.java:42)
    at com.intellij.ui.popup.PopupFactoryImpl$ActionPopupStep$1.run(PopupFactoryImpl.java:746)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:715)
    at java.awt.EventQueue.access$400(EventQueue.java:82)
    at java.awt.EventQueue$2.run(EventQueue.java:676)
    at java.awt.EventQueue$2.run(EventQueue.java:674)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:685)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:734)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:569)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Enum support

Thanks realy usefull plugin! Could you please fix enum support? It is not working. Parcelable item does not present in Generate menu for enum type. Thanks!

java.util.Date parcelization

Plugin worked great for me, thanks!
With only drawback: Having field of java.util.Date class, the plugin tries to

dest.writeParcelable(this.mDate, flags);

instead of

dest.writeSerializable(this.mDate);

How to parcel private List<T> data;

i have code private List<T> data; , and i got problem on Parcel in, have idea ?

@SerializedName("message")
    private String message;
    @SerializedName("data")
    private List<T> data;

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }

    public ResponseListService() {
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.message);
        dest.writeList(this.data);
    }

    protected ResponseListService(Parcel in) {
        this.message = in.readString();
        this.data = new ArrayList<T>();
        in.readList(this.data, T.class.getClassLoader());
    }

    public static final Creator<ResponseListService> CREATOR = new Creator<ResponseListService>() {
        @Override
        public ResponseListService createFromParcel(Parcel source) {
            return new ResponseListService(source);
        }

        @Override
        public ResponseListService[] newArray(int size) {
            return new ResponseListService[size];
        }
    };

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.