public <E> E getGenericProperty(final String key, final E def) { if (def == null || Clazz.isPrimitive(def.getClass())) { return storage.get(key, def); } else { System.out.println("Read " + path + "." + key + (plain ? ".json" : ".ejs")); return JSonStorage.restoreFromFile( new File(path + "." + key + (plain ? ".json" : ".ejs")), def); } }
public Object getProperty(final String key, final Object def) { try { if (storage.hasProperty(key)) { return this.storage.get(key, (String) null); } else if (getObjectKey(key).exists()) { if (def != null) { return JSonStorage.restoreFromFile(getObjectKey(key), def); } else { TypeRef<?> ref = getType(key); System.out.println("Read " + path + "." + key + (plain ? ".json" : ".ejs")); if (ref == null) { Log.exception(new Exception(path + ".json." + key + " type missing")); } return JSonStorage.restoreFrom(getObjectKey(key), true, null, ref, null); } } } catch (Throwable e) { e.printStackTrace(); } return def; }