Skip to content

Instantly share code, notes, and snippets.

@fumingshih
Created May 18, 2013 19:21
Show Gist options
  • Save fumingshih/5605501 to your computer and use it in GitHub Desktop.
Save fumingshih/5605501 to your computer and use it in GitHub Desktop.
code for gson factory
public TypeAdapterFactory getPipelineFactory() {
return getPipelineFactory(this);
}
private static PipelineFactory PIPELINE_FACTORY;
public static PipelineFactory getPipelineFactory(Context context) {
if (PIPELINE_FACTORY == null) {
PIPELINE_FACTORY = new PipelineFactory(context);
}
return PIPELINE_FACTORY;
}
public SingletonTypeAdapterFactory getProbeFactory() {
return getProbeFactory(this);
}
private static SingletonTypeAdapterFactory PROBE_FACTORY;
public static SingletonTypeAdapterFactory getProbeFactory(Context context) {
if (PROBE_FACTORY == null) {
PROBE_FACTORY = new SingletonTypeAdapterFactory(
new DefaultRuntimeTypeAdapterFactory<Probe>(
context,
Probe.class,
null,
new ContextInjectorTypeAdapaterFactory(context, new ConfigurableTypeAdapterFactory())));
}
return PROBE_FACTORY;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment