Skip to content

Instantly share code, notes, and snippets.

@johncarl81
Last active December 10, 2015 13:28
Show Gist options
  • Save johncarl81/4440619 to your computer and use it in GitHub Desktop.
Save johncarl81/4440619 to your computer and use it in GitHub Desktop.
public class Parcels {
public static final String PARCELS_NAME = "Parcels";
public static final String PARCELS_REPOSITORY_NAME = "Transfuse$Parcels";
public static final String PARCELS_PACKAGE = "org.androidtransfuse";
private static final ParcelRepository PARCELS;
static{
ParcelRepository parcelsCreation;
try{
Class injectorClass = Class.forName(PARCELS_PACKAGE + "." + PARCELS_REPOSITORY_NAME);
parcelsCreation = (ParcelRepository) injectorClass.newInstance();
} catch (ClassNotFoundException e) {
parcelsCreation = null;
} catch (InstantiationException e) {
throw new TransfuseRuntimeException("Unable to instantiate generated InjectorRepository", e);
} catch (IllegalAccessException e) {
throw new TransfuseRuntimeException("Unable to access generated InjectorRepository", e);
}
PARCELS = parcelsCreation;
}
public static Parcelable wrap(Object input) {
return PARCELS.wrap(input);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment