denley / courier

A delivery service for Android Wear. Courier uses the DataApi and MessageApi to deliver objects between devices simply and cleanly.
Apache License 2.0
80 stars 5 forks source link

List Support #22

Open yurifariasg opened 9 years ago

yurifariasg commented 9 years ago

Hi,

So far Courier seems like a great library. I was wondering if lists are going to be supported in the future. I know that DataMap has the support to add DataMap ArrayLists and even ArrayList of certain types like Double or String.

Are you planning to support ArrayList type on Deliverable objects in the future?

denley commented 9 years ago

Hi Yuri, thanks for using Courier.

@Deliverable annotated classes currently support every type that is possible to put into a DataMap, including ArrayList<Integer>, ArrayList<String>, ArrayList<DataMap>, byte[], float[], long[] and String[]. These are the only array types that are able to be put into a DataMap (see the docs).

If you are having a specific issue with any of these types, then please give me some more details (like the specific type, and a description of the unexpected behaviour you are seeing) and I will look into it further.

yurifariasg commented 9 years ago

You are right, I was not using any of these specific types. I was trying to actually use ArrayLists of another Deliverable. I thought this could be supported since you will eventually parse them into DataMaps and Lists of DataMaps are supported.

I ended up creating a DataMap ArrayList and parsing the Deliverables myself, but it would be great if the library managed that...

denley commented 9 years ago

Thanks for the clarification. This is something I hadn't thought of, and it definitely should be supported. I'll take it on board.

denley commented 9 years ago

This has been resolved. The fix has been pushed to this repo, but it's not released yet.

It has occurred to me that other types could also be supported as fields, like anything implementing Serializable, or an ArrayList of them. We could also be more generic than ArrayList by supporting List, Collection and Iterable fields (anything that ArrayList itself implements or extends from).

I want to give these some thought before releasing the next version. I'll comment here and close this issue when it's released.

yurifariasg commented 9 years ago

Awesome! Thanks. Looking forward to see it in the next version.

mitchross commented 8 years ago

Bump on this?

denley commented 8 years ago

This is in release as of 1.2.0 (latest version is 1.2.1). You can use an ArrayList of anything that extends Deliverable.

I think I've just left this open because the advanced stuff isn't done (Serializable, List, etc. fields). Pull requests are welcome.