Tabnine Logo
ModuleItem.getType
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: org.scijava/scijava-common

protected <T> ModuleItem<T> asType(final ModuleItem<?> item,
  final Class<T> type)
{
  if (!type.isAssignableFrom(item.getType())) {
    return null;
  }
  @SuppressWarnings("unchecked")
  final ModuleItem<T> typedItem = (ModuleItem<T>) item;
  return typedItem;
}
origin: org.scijava/batch-processor

@Override
public boolean canProvide(ModuleItem<?> item) {
  // we can't provide inputs for saving files
  return item.getType() == File.class && !hasStyle(item, FileWidget.SAVE_STYLE);
}
origin: scijava/scijava-common

/** Converts the given object to a number matching the input type. */
private Number toNumber(final Object value) {
  final Class<?> type = item.getType();
  final Class<?> saneType = Types.box(type);
  return NumberUtils.toNumber(value, saneType);
}
origin: org.scijava/scijava-common

/** Converts the given object to a number matching the input type. */
private Number toNumber(final Object value) {
  final Class<?> type = item.getType();
  final Class<?> saneType = Types.box(type);
  return NumberUtils.toNumber(value, saneType);
}
origin: org.scijava/batch-processor

  protected void scriptFileCallback() {
    if (scriptFile != null) {
      moduleInfo = scripts.getScript(scriptFile);
      int nCompatibleInputs = 0;
      for (ModuleItem<?> input : moduleInfo.inputs()) {
        if (convert.supports(new File(""), input.getType())) {
          nCompatibleInputs++;
        }
      }
      scriptMessage = "This script contains " + nCompatibleInputs + " compatible inputs.";
    }
  }
}
origin: org.scijava/scijava-common

@Override
public Number getMax() {
  final Number max = toNumber(item.getMaximumValue());
  if (max != null) return max;
  return NumberUtils.getMaximumNumber(item.getType());
}
origin: org.scijava/scijava-common

@Override
public Number getStepSize() {
  final Number stepSize = toNumber(item.getStepSize());
  if (stepSize != null) return stepSize;
  return NumberUtils.toNumber("1", item.getType());
}
origin: org.scijava/scijava-common

@Override
public Number getMin() {
  final Number min = toNumber(item.getMinimumValue());
  if (min != null) return min;
  return NumberUtils.getMinimumNumber(item.getType());
}
origin: scijava/scijava-common

@Override
public Number getMax() {
  final Number max = toNumber(item.getMaximumValue());
  if (max != null) return max;
  return NumberUtils.getMaximumNumber(item.getType());
}
origin: org.scijava/scijava-table

private boolean isSimple(final Module m, final ModuleItem<?> item) {
  final Class<?> type = item.getType();
  return isSimpleType(type) || //
    // NB: The output is typed on Object -- maybe the default result output.
    // In this case, let's decide based on the actual value rather than type.
    type == Object.class && isSimpleValue(item.getValue(m));
}
origin: scijava/scijava-common

@Override
public Number getStepSize() {
  final Number stepSize = toNumber(item.getStepSize());
  if (stepSize != null) return stepSize;
  return NumberUtils.toNumber("1", item.getType());
}
origin: org.scijava/scijava-common

private <S extends Service> void setServiceValue(final Context context,
  final Module module, final ModuleItem<S> input)
{
  final S service = context.getService(input.getType());
  input.setValue(module, service);
  module.resolveInput(input.getName());
}
origin: imagej/imagej-ops

/**
 * Gets the given {@link ModuleInfo}'s list of inputs, excluding special ones
 * like {@link Service}s and {@link Context}s.
 */
public static List<ModuleItem<?>> inputs(final ModuleInfo info) {
  final List<ModuleItem<?>> inputs = asList(info.inputs());
  return filter(inputs, input -> !isInjectable(input.getType()));
}
origin: scijava/scijava-common

private <S extends Service> void setServiceValue(final Context context,
  final Module module, final ModuleItem<S> input)
{
  final S service = context.getService(input.getType());
  input.setValue(module, service);
  module.resolveInput(input.getName());
}
origin: org.scijava/scijava-common

private <T> void assignDefaultValue(final Module module,
  final ModuleItem<T> item)
{
  if (module.isInputResolved(item.getName())) return;
  final T nullValue = Types.nullValue(item.getType());
  if (!Objects.equals(item.getValue(module), nullValue)) return;
  final T defaultValue = moduleService.getDefaultValue(item);
  if (defaultValue == null) return;
  item.setValue(module, defaultValue);
}
origin: scijava/scijava-common

private <T> void assignDefaultValue(final Module module,
  final ModuleItem<T> item)
{
  if (module.isInputResolved(item.getName())) return;
  final T nullValue = Types.nullValue(item.getType());
  if (!Objects.equals(item.getValue(module), nullValue)) return;
  final T defaultValue = moduleService.getDefaultValue(item);
  if (defaultValue == null) return;
  item.setValue(module, defaultValue);
}
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

/** Loads the value of the given module item from persistent storage. */
private <T> void loadValue(final Module module, final ModuleItem<T> item) {
  // skip input that has already been resolved
  if (module.isInputResolved(item.getName())) return;
  final T prefValue = moduleService.load(item);
  final Class<T> type = item.getType();
  final T defaultValue = item.getValue(module);
  final T value = getBestValue(prefValue, defaultValue, type);
  item.setValue(module, value);
}
origin: imagej/imagej-ops

private boolean inputTypesMatch(final OpCandidate candidate) {
  // check for assignment compatibility, including generics
  if (!matcher.typesMatch(candidate)) return false;
  // also check that raw types exactly match
  final Object[] paddedArgs = matcher.padArgs(candidate);
  int i = 0;
  for (final ModuleItem<?> input : candidate.inputs()) {
    final Object arg = paddedArgs[i++];
    if (!typeMatches(arg, input.getType())) return false;
  }
  return true;
}
org.scijava.moduleModuleItemgetType

Javadoc

Gets the type of the item.

Popular methods of ModuleItem

  • getName
  • 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.
  • getDefaultValue
    Gets the default value.
  • getChoices,
  • getDefaultValue,
  • getDescription,
  • getIOType,
  • getMaximumValue,
  • getMinimumValue,
  • getPersistKey,
  • getSoftMaximum,
  • getSoftMinimum

Popular in Java

  • Finding current android device location
  • getSupportFragmentManager (FragmentActivity)
  • compareTo (BigDecimal)
  • notifyDataSetChanged (ArrayAdapter)
  • Kernel (java.awt.image)
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Collectors (java.util.stream)
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • CodeWhisperer alternatives
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