<div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 2, 2012 at 3:51 PM, Summers Pittman <span dir="ltr">&lt;<a href="mailto:supittma@redhat.com" target="_blank">supittma@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
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 &quot;only&quot; an implementation detail.<br>
<br>
1) Do we want to say for 1.x that GSON IS the library we are using?  (Yes)</blockquote><div>+1</div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
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></blockquote><div>Yes, I think we should provide pluggability. Maybe even for 1.0 as it seems fairly easy.</div>
<div><br></div><div>This would cover our current serialization needs:</div><div><br></div><div>public interface Marshaller&lt;T&gt; {</div><div>   void String marshal(T obj) throws IOException;</div><div>   void List&lt;T&gt; unmarshal(String json) throws IOException;</div>
<div>}</div><div><br></div><div>With Builder pattern you could specify Marshaller at Pipe creation time i.e.:</div><div><br></div><div>new Pipe.Builder().useMarshaller(Pipe.DEFAULT_MARSHALLER)</div><div>    .name(&quot;tasks&quot;)</div>
<div>    .useClass(Task.class).build().</div><div><br></div><div>Where Pipe.DEFAULT_MARSHALLER == &quot;org.aerogear.android.serialization.impl.GSONMarshaller&quot;;</div><div><br></div><div>User has no compile-time dependency on impl detail, and has the ability to plug in something of her own.</div>
<div><br></div><div><div>(I noticed Builder vs. Configuration object debate. Will comment more there.)</div></div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

2.1) How much do we want to expose/allow to be configured? (No idea)<br>
<br></blockquote><div><br></div><div>The above pattern doesn&#39;t account for any configuration. System properties could be used (ugly). But it can be changed - use MarshallerFactory object instead of Marshaller class name:</div>
<div><br></div><div>public interface MarshallerFactory {</div><div><br></div><div>   Marshaller newMarshaller();</div><div>}</div><div><br></div><div>new Pipe.Builder().useMarshallerFactory(new org.aerogear.android.serialization.GSONMarshallerFactory())</div>
<div>    .name(&quot;tasks&quot;)</div><div>    .build();</div><div><br></div><div>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.</div>
<div><br></div><div><br></div><div>I think pluggability would be really good to have for version 1.0 already. As it influences the builder / factory patterns. It&#39;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.</div>
<div><br></div><div>Besides Serialization one aspect of pluggability could be Transport i.e. plug in HttpURLConnection instead of HttpClient.</div><div><br></div><div><br></div><div>- marko</div><div><br></div><div><br></div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
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>
</blockquote></div><br></div>