<div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 5, 2012 at 4:35 PM, Summers Pittman <span dir="ltr"><<a href="mailto:supittma@redhat.com" target="_blank">supittma@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">>Do google has plans to phase out GSON? If not what would we benefit from abstracting this?<br>
</div>Google should be keeping this around for a while. Their project page is getting regular activity.<br>
<br>
If we abstract it away then we can make our serialization format different. (Who knows, someone may want to use SOAP instead of rest)<br>
<br></blockquote><div><br></div><div>Yes, all that. </div><div><br></div><div>- marko</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
But for 1.0 I think exposing an option constructor parameter/builder method/config option which takes a GsonBuilder is the way to go.<br>
<div class="im"><br>
<br>
>For me it looks like the way to go on JSON for android.<br>
</div>+1<br>
<div class="HOEnZb"><div class="h5">----- Original Message -----<br>
From: "Douglas Campos" <<a href="mailto:qmx@qmx.me">qmx@qmx.me</a>><br>
To: "AeroGear Developer Mailing List" <<a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a>><br>
Sent: Monday, November 5, 2012 10:27:27 AM<br>
Subject: Re: [aerogear-dev] JSON Serialization in Android<br>
<br>
<br>
<br>
<br>
<br>
On Nov 5, 2012, at 10:13 AM, Marko Strukelj wrote:<br>
<br>
><br>
> On Fri, Nov 2, 2012 at 3:51 PM, Summers Pittman <<a href="mailto:supittma@redhat.com">supittma@redhat.com</a>> wrote:<br>
> Right now we have JSON serialization in Android implemented by a default configuration GSON instance.<br>
><br>
> I am updating the docs to note this, however it is "only" an implementation detail.<br>
><br>
> 1) Do we want to say for 1.x that GSON IS the library we are using? (Yes)<br>
> +1<br>
><br>
> 2) Do we want to provide a configuration point for Serialization (GSON if yes to 1, something more general if No)? (Yes, but not for 1.0)<br>
> Yes, I think we should provide pluggability. Maybe even for 1.0 as it seems fairly easy.<br>
><br>
> This would cover our current serialization needs:<br>
><br>
> public interface Marshaller<T> {<br>
> void String marshal(T obj) throws IOException;<br>
> void List<T> unmarshal(String json) throws IOException;<br>
> }<br>
><br>
> With Builder pattern you could specify Marshaller at Pipe creation time i.e.:<br>
><br>
> new Pipe.Builder().useMarshaller(Pipe.DEFAULT_MARSHALLER)<br>
> .name("tasks")<br>
> .useClass(Task.class).build().<br>
><br>
> Where Pipe.DEFAULT_MARSHALLER == "org.aerogear.android.serialization.impl.GSONMarshaller";<br>
><br>
> User has no compile-time dependency on impl detail, and has the ability to plug in something of her own.<br>
><br>
> (I noticed Builder vs. Configuration object debate. Will comment more there.)<br>
><br>
><br>
> 2.1) How much do we want to expose/allow to be configured? (No idea)<br>
><br>
><br>
> The above pattern doesn't account for any configuration. System properties could be used (ugly). But it can be changed - use MarshallerFactory object instead of Marshaller class name:<br>
><br>
> public interface MarshallerFactory {<br>
><br>
> Marshaller newMarshaller();<br>
> }<br>
><br>
> new Pipe.Builder().useMarshallerFactory(new org.aerogear.android.serialization.GSONMarshallerFactory())<br>
> .name("tasks")<br>
> .build();<br>
><br>
> This time GSONMarshallerFactory is part of an API. And user can create any implementation of MarshallerFactory and use it to create and configure a custom Marshaller.<br>
><br>
><br>
> I think pluggability would be really good to have for version 1.0 already. As it influences the builder / factory patterns. It's the only way to make sure the patterns we use really are pluggable otherwise we may very quickly have to deprecate some of 1.0 API.<br>
><br>
> Besides Serialization one aspect of pluggability could be Transport i.e. plug in HttpURLConnection instead of HttpClient.<br>
><br>
><br>
> - marko<br>
><br>
><br>
> Relevant Jira:<a href="https://issues.jboss.org/browse/AEROGEAR-596" target="_blank">https://issues.jboss.org/browse/AEROGEAR-596</a><br>
><br>
> Summers<br>
> _______________________________________________<br>
> aerogear-dev mailing list<br>
> <a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
><br>
> _______________________________________________<br>
> aerogear-dev mailing list<br>
> <a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
<br>
-- qmx<br>
<br>
<br>
_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
</div></div></blockquote></div><br></div>