@Override public String getPref(final String key) { return Prefs.get(this.getClass(), key); }
/** * @return whether the user specified not to be reminded again */ public static boolean neverRemind() { final String latestNag = Prefs.get(UpToDate.class, KEY); if (latestNag == null || latestNag.equals("")) return false; final long time = Long.parseLong(latestNag); return time == Long.MAX_VALUE; }
/** * @return whether the user said that she wanted to be reminded later */ public static boolean shouldRemindLater() { final String latestNag = Prefs.get(UpToDate.class, KEY); if (latestNag == null || latestNag.equals("")) return false; return now() - Long.parseLong(latestNag) < REMINDER_INTERVAL; }
/** * Returns the persisted value of a ModuleItem. Returns null if nothing has * been persisted. It is the API user's responsibility to check the return * value for null. */ @Override @Deprecated public T loadValue() { // if there is nothing to load from persistence return nothing if (!isPersisted()) return null; final String sValue; final String persistKey = getPersistKey(); if (persistKey == null || persistKey.isEmpty()) { final Class<?> prefClass = getDelegateClass(); final String prefKey = getName(); sValue = Prefs.get(prefClass, prefKey); } else sValue = Prefs.get(persistKey); // if persisted value has never been set before return null if (sValue == null) return null; return ConversionUtils.convert(sValue, getType()); }
/** * Returns the persisted value of a ModuleItem. Returns null if nothing has * been persisted. It is the API user's responsibility to check the return * value for null. */ @Override @Deprecated public T loadValue() { // if there is nothing to load from persistence return nothing if (!isPersisted()) return null; final String sValue; final String persistKey = getPersistKey(); if (persistKey == null || persistKey.isEmpty()) { final Class<?> prefClass = getDelegateClass(); final String prefKey = getName(); sValue = Prefs.get(prefClass, prefKey); } else sValue = Prefs.get(persistKey); // if persisted value has never been set before return null if (sValue == null) return null; return ConversionUtils.convert(sValue, getType()); }