@Test public void testStore() throws Exception { ConcreteInt instance = new ConcreteInt(10); File f = instance.store(); ConcreteInt loaded = (ConcreteInt) ConcreteInt.load(ConcreteInt.class); assert(instance.equals(loaded)); }
public File store() throws IOException { Properties p = new Properties(); p.setProperty("seed", "" + seed); for (Field f : getClass().getDeclaredFields()) { try { f.setAccessible(true); p.setProperty(f.getName(), "" + f.get(this)); } catch (IllegalAccessException ex) { Logger.getLogger(AbstractConfiguration.class.getName()).log(Level.SEVERE, null, ex); throw new IOException("IllegalAccessException - " + ex.getMessage()); } } File file = File.createTempFile(getClass().getCanonicalName(), "kompics"); Writer writer = new FileWriter(file); p.store(writer, getClass().getCanonicalName()); System.setProperty(getClass().getCanonicalName(), file.getCanonicalPath()); return file; }
AbstractConfiguration { public File store() throws IOException { Properties p = new Properties(); p.setProperty("seed", "" + seed); for (Field f : getClass().getDeclaredFields()) { try { f.setAccessible(true); p.setProperty(f.getName(), "" + f.get(this)); } catch (IllegalAccessException ex) { Logger.getLogger(AbstractConfiguration.class.getName()).log(Level.SEVERE, null, ex); throw new IOException("IllegalAccessException - " + ex.getMessage()); } } File file = File.createTempFile(getClass().getCanonicalName(), "kompics"); Writer writer = new FileWriter(file); p.store(writer, getClass().getCanonicalName()); System.setProperty(getClass().getCanonicalName(), file.getCanonicalPath()); return file; } }
AbstractConfiguration { public File store() throws IOException { Properties p = new Properties(); p.setProperty("seed", "" + seed); for (Field f : getClass().getDeclaredFields()) { try { f.setAccessible(true); p.setProperty(f.getName(), "" + f.get(this)); } catch (IllegalAccessException ex) { Logger.getLogger(AbstractConfiguration.class.getName()).log(Level.SEVERE, null, ex); throw new IOException("IllegalAccessException - " + ex.getMessage()); } } File file = File.createTempFile(getClass().getCanonicalName(), "kompics"); Writer writer = new FileWriter(file); p.store(writer, getClass().getCanonicalName()); System.setProperty(getClass().getCanonicalName(), file.getCanonicalPath()); return file; } protected  AbstractConfiguration(); }
AbstractConfiguration { public File store() throws IOException { Properties p = new Properties(); p.setProperty("seed", "" + seed); for (Field f : getClass().getDeclaredFields()) { try { f.setAccessible(true); p.setProperty(f.getName(), "" + f.get(this)); } catch (IllegalAccessException ex) { Logger.getLogger(AbstractConfiguration.class.getName()).log(Level.SEVERE, null, ex); throw new IOException("IllegalAccessException - " + ex.getMessage()); } } File file = File.createTempFile(getClass().getCanonicalName(), "kompics"); Writer writer = new FileWriter(file); p.store(writer, getClass().getCanonicalName()); System.setProperty(getClass().getCanonicalName(), file.getCanonicalPath()); return file; } protected  AbstractConfiguration(); File store(); T loadP(Class<? extends AbstractConfiguration> t, String file); static AbstractConfiguration load(Class<? extends AbstractConfiguration> type); int getSeed(); T setSeed(int seed); }
AbstractConfiguration { public File store() throws IOException { Properties p = new Properties(); p.setProperty("seed", "" + seed); for (Field f : getClass().getDeclaredFields()) { try { f.setAccessible(true); p.setProperty(f.getName(), "" + f.get(this)); } catch (IllegalAccessException ex) { Logger.getLogger(AbstractConfiguration.class.getName()).log(Level.SEVERE, null, ex); throw new IOException("IllegalAccessException - " + ex.getMessage()); } } File file = File.createTempFile(getClass().getCanonicalName(), "kompics"); Writer writer = new FileWriter(file); p.store(writer, getClass().getCanonicalName()); System.setProperty(getClass().getCanonicalName(), file.getCanonicalPath()); return file; } protected  AbstractConfiguration(); File store(); T loadP(Class<? extends AbstractConfiguration> t, String file); static AbstractConfiguration load(Class<? extends AbstractConfiguration> type); int getSeed(); T setSeed(int seed);  }