@Override public Type getGenericType() { return getType(); }
@Override public Type getGenericType() { return getType(); }
@Override public List<T> getChoices() { final T[] choices = getType().getEnumConstants(); return choices == null ? null : Arrays.asList(choices); }
@Override public List<T> getChoices() { final T[] choices = getType().getEnumConstants(); return choices == null ? null : Arrays.asList(choices); }
@Override @Deprecated public void saveValue(final T value) { if (!isPersisted()) return; final String sValue = value == null ? "" : value.toString(); // do not persist if object cannot be converted back from a string if (!ConversionUtils.canConvert(sValue, getType())) return; final String persistKey = getPersistKey(); if (persistKey == null || persistKey.isEmpty()) { final Class<?> prefClass = getDelegateClass(); final String prefKey = getName(); Prefs.put(prefClass, prefKey, sValue); } else Prefs.put(persistKey, sValue); }
@Override @Deprecated public void saveValue(final T value) { if (!isPersisted()) return; final String sValue = value == null ? "" : value.toString(); // do not persist if object cannot be converted back from a string if (!ConversionUtils.canConvert(sValue, getType())) return; final String persistKey = getPersistKey(); if (persistKey == null || persistKey.isEmpty()) { final Class<?> prefClass = getDelegateClass(); final String prefKey = getName(); Prefs.put(prefClass, prefKey, sValue); } else Prefs.put(persistKey, sValue); }
/** * 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()); }
@Override public String toString() { final StringMaker sm = new StringMaker(); sm.append("label", getLabel()); sm.append("description", getDescription()); sm.append("visibility", getVisibility(), ItemVisibility.NORMAL); sm.append("required", isRequired()); sm.append("persisted", isPersisted()); sm.append("persistKey", getPersistKey()); sm.append("callback", getCallback()); sm.append("widgetStyle", getWidgetStyle()); sm.append("default", getDefaultValue()); sm.append("min", getMinimumValue()); sm.append("max", getMaximumValue()); sm.append("softMin", getSoftMinimum()); sm.append("softMax", getSoftMaximum()); sm.append("stepSize", getStepSize(), NumberUtils.toNumber("1", getType())); sm.append("columnCount", getColumnCount(), 6); sm.append("choices", getChoices()); return getName() + ": " + sm.toString(); }
@Override public String toString() { final StringMaker sm = new StringMaker(); sm.append("label", getLabel()); sm.append("description", getDescription()); sm.append("visibility", getVisibility(), ItemVisibility.NORMAL); sm.append("required", isRequired()); sm.append("persisted", isPersisted()); sm.append("persistKey", getPersistKey()); sm.append("callback", getCallback()); sm.append("widgetStyle", getWidgetStyle()); sm.append("default", getDefaultValue()); sm.append("min", getMinimumValue()); sm.append("max", getMaximumValue()); sm.append("softMin", getSoftMinimum()); sm.append("softMax", getSoftMaximum()); sm.append("stepSize", getStepSize(), NumberUtils.toNumber("1", getType())); sm.append("columnCount", getColumnCount(), 6); sm.append("choices", getChoices()); return getName() + ": " + sm.toString(); }