public void put( String key, Collection<? extends Bundlable> collection ) { JSONArray array = new JSONArray(); for (Bundlable object : collection) { Bundle bundle = new Bundle(); bundle.put( CLASS_NAME, object.getClass().getName() ); object.storeInBundle( bundle ); array.put( bundle.data ); } try { data.put( key, array ); } catch (JSONException e) { } }
public void put( String key, Bundlable object ) { if (object != null) { try { Bundle bundle = new Bundle(); bundle.put( CLASS_NAME, object.getClass().getName() ); object.storeInBundle( bundle ); data.put( key, bundle.data ); } catch (JSONException e) { } } }
public void put( String key, Bundlable object ) { if (object != null) { try { Bundle bundle = new Bundle(); bundle.put( CLASS_NAME, object.getClass().getName() ); object.storeInBundle( bundle ); data.put( key, bundle.data ); } catch (JSONException e) { Game.reportException(e); } } }
public void put( String key, Bundlable object ) { if (object != null) { try { Bundle bundle = new Bundle(); bundle.put( CLASS_NAME, object.getClass().getName() ); object.storeInBundle( bundle ); data.put( key, bundle.data ); } catch (JSONException e) { Game.reportException(e); } } }
public void put( String key, Collection<? extends Bundlable> collection ) { JSONArray array = new JSONArray(); for (Bundlable object : collection) { //Skip none-static inner classes as they can't be instantiated through bundle restoring //Classes which make use of none-static inner classes must manage instantiation manually if (object != null) { Class cl = object.getClass(); if (!cl.isMemberClass() || Modifier.isStatic(cl.getModifiers())) { Bundle bundle = new Bundle(); bundle.put(CLASS_NAME, cl.getName()); object.storeInBundle(bundle); array.put(bundle.data); } } } try { data.put( key, array ); } catch (JSONException e) { Game.reportException(e); } }
public void put( String key, Collection<? extends Bundlable> collection ) { JSONArray array = new JSONArray(); for (Bundlable object : collection) { //Skip none-static inner classes as they can't be instantiated through bundle restoring //Classes which make use of none-static inner classes must manage instantiation manually if (object != null) { Class cl = object.getClass(); if (!cl.isMemberClass() || Modifier.isStatic(cl.getModifiers())) { Bundle bundle = new Bundle(); bundle.put(CLASS_NAME, cl.getName()); object.storeInBundle(bundle); array.put(bundle.data); } } } try { data.put( key, array ); } catch (JSONException e) { Game.reportException(e); } }