congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
ModuleItem.isPersisted
Code IndexAdd Tabnine to your IDE (free)

How to use
isPersisted
method
in
org.scijava.module.ModuleItem

Best Java code snippets using org.scijava.module.ModuleItem.isPersisted (Showing top 7 results out of 315)

origin: scijava/scijava-common

@Override
public <T> T load(final ModuleItem<T> item) {
  // if there is nothing to load from persistence return nothing
  if (!item.isPersisted()) return null;
  final String sValue = prefService.get(prefClass(item), prefKey(item));
  // if persisted value has never been set before return null
  if (sValue == null) return null;
  return convertService.convert(sValue, item.getType());
}

origin: org.scijava/scijava-common

@Override
public <T> T load(final ModuleItem<T> item) {
  // if there is nothing to load from persistence return nothing
  if (!item.isPersisted()) return null;
  final String sValue = prefService.get(prefClass(item), prefKey(item));
  // if persisted value has never been set before return null
  if (sValue == null) return null;
  return convertService.convert(sValue, item.getType());
}

origin: org.scijava/scijava-common

@Override
public <T> void save(final ModuleItem<T> item, final T value) {
  if (!item.isPersisted()) return;
  if (Objects.equals(item.getDefaultValue(), value)) {
    // NB: Do not persist the value if it is the default.
    // This is nice if the default value might change later,
    // such as when iteratively developing a script.
    prefService.remove(prefClass(item), prefKey(item));
    return;
  }
  final String sValue = value == null ? "" : convertService.convert(value, String.class);
  // do not persist if object cannot be converted back from a string
  if (!convertService.supports(sValue, item.getType())) return;
  prefService.put(prefClass(item), prefKey(item), sValue);
}
origin: scijava/scijava-common

@Override
public <T> void save(final ModuleItem<T> item, final T value) {
  if (!item.isPersisted()) return;
  if (Objects.equals(item.getDefaultValue(), value)) {
    // NB: Do not persist the value if it is the default.
    // This is nice if the default value might change later,
    // such as when iteratively developing a script.
    prefService.remove(prefClass(item), prefKey(item));
    return;
  }
  final String sValue = value == null ? "" : convertService.convert(value, String.class);
  // do not persist if object cannot be converted back from a string
  if (!convertService.supports(sValue, item.getType())) return;
  prefService.put(prefClass(item), prefKey(item), sValue);
}
origin: org.scijava/scijava-common

/** Creates a new module item with the same values as the given item. */
public DefaultMutableModuleItem(final ModuleInfo info,
  final ModuleItem<T> item)
{
  super(info);
  name = item.getName();
  type = item.getType();
  genericType = item.getGenericType();
  ioType = item.getIOType();
  visibility = item.getVisibility();
  required = item.isRequired();
  persisted = item.isPersisted();
  persistKey = item.getPersistKey();
  initializer = item.getInitializer();
  validater = item.getValidater();
  callback = item.getCallback();
  widgetStyle = item.getWidgetStyle();
  minimumValue = item.getMinimumValue();
  maximumValue = item.getMaximumValue();
  softMinimum = item.getSoftMinimum();
  softMaximum = item.getSoftMaximum();
  stepSize = item.getStepSize();
  columnCount = item.getColumnCount();
  final List<T> itemChoices = item.getChoices();
  if (itemChoices != null) choices.addAll(itemChoices);
  label = item.getLabel();
  description = item.getDescription();
}
origin: scijava/scijava-common

/** Creates a new module item with the same values as the given item. */
public DefaultMutableModuleItem(final ModuleInfo info,
  final ModuleItem<T> item)
{
  super(info);
  name = item.getName();
  type = item.getType();
  genericType = item.getGenericType();
  ioType = item.getIOType();
  visibility = item.getVisibility();
  required = item.isRequired();
  persisted = item.isPersisted();
  persistKey = item.getPersistKey();
  initializer = item.getInitializer();
  validater = item.getValidater();
  callback = item.getCallback();
  widgetStyle = item.getWidgetStyle();
  minimumValue = item.getMinimumValue();
  maximumValue = item.getMaximumValue();
  softMinimum = item.getSoftMinimum();
  softMaximum = item.getSoftMaximum();
  stepSize = item.getStepSize();
  columnCount = item.getColumnCount();
  final List<T> itemChoices = item.getChoices();
  if (itemChoices != null) choices.addAll(itemChoices);
  label = item.getLabel();
  description = item.getDescription();
}
origin: scijava/scijava-common

private void assertItem(final String name, final Class<?> type,
  final String label, final ItemIO ioType, final boolean required,
  final boolean persist, final String persistKey, final String style,
  final Object value, final Object min, final Object max,
  final Object softMin, final Object softMax, final Number stepSize,
  final List<?> choices, final ModuleItem<?> item)
{
  assertEquals(name, item.getName());
  assertSame(type, item.getType());
  assertEquals(label, item.getLabel());
  assertSame(ioType, item.getIOType());
  assertEquals(required, item.isRequired());
  assertEquals(persist, item.isPersisted());
  assertEquals(persistKey, item.getPersistKey());
  assertEquals(style, item.getWidgetStyle());
  assertEquals(value, item.getDefaultValue());
  assertEquals(min, item.getMinimumValue());
  assertEquals(max, item.getMaximumValue());
  assertEquals(softMin, item.getSoftMinimum());
  assertEquals(softMax, item.getSoftMaximum());
  assertEquals(stepSize, item.getStepSize());
  assertEquals(choices, item.getChoices());
}
org.scijava.moduleModuleItemisPersisted

Javadoc

Gets whether to remember the most recent value of the parameter.

Popular methods of ModuleItem

  • getName
  • getType
    Gets the type of the item.
  • getWidgetStyle
    Gets the preferred widget style to use when rendering the item in a user interface.
  • getValue
    Gets the item's current value with respect to the given module.
  • isRequired
    Gets whether the item value must be specified (i.e., no default).
  • getColumnCount
    Gets the preferred width of the input field in characters (if applicable).
  • getGenericType
    Gets the type of the item, including Java generic parameters. For many modules, this may be the same
  • getLabel
  • getVisibility
    Gets the visibility of the item.
  • setValue
    Sets the item's current value with respect to the given module.
  • get
  • getChoices
    Gets the list of possible values.
  • get,
  • getChoices,
  • getDefaultValue,
  • getDescription,
  • getIOType,
  • getMaximumValue,
  • getMinimumValue,
  • getPersistKey,
  • getSoftMaximum,
  • getSoftMinimum

Popular in Java

  • Start an intent from android
  • findViewById (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • setContentView (Activity)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • JTextField (javax.swing)
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now