Class DefaultViewSettingsValidationUtil

java.lang.Object
org.knime.core.webui.node.dialog.defaultdialog.DefaultViewSettingsValidationUtil

public final class DefaultViewSettingsValidationUtil extends Object
A utility class for validating view DefaultNodeSettings instances overwritten by flow variables. Use this in a node model (within NodeModel.validateViewSettings(org.knime.core.node.NodeSettingsRO)) for a node using DefaultNodeSettings view variables. As a typical example where this validation is useful: When overwriting an enum field with a string flow variable which does not have one of the string values, overwriting the node settings with the default node settings does not throw an error. This error is only thrown when loading the node settings to DefaultNodeSettings which, in case of view settings, is not caught unless this class is used as node model.
Author:
Paul Bärnreuther
  • Method Details

    • validateViewSettings

      public static void validateViewSettings(org.knime.core.node.NodeSettingsRO viewSettings, Class<? extends DefaultNodeSettings> viewSettingsClass) throws org.knime.core.node.InvalidSettingsException
      Try to load the view settings (already overwritten by flow variables) to DefaultNodeSettings.
      Parameters:
      viewSettings - the to be validated view settings
      viewSettingsClass - the class of the view settings. Although it is odd, that any information regarding view settings is part of the node model, it is wanted here, as view settings should be treated as model settings when loading them is erroneous. But this class is and should only be used for the validation here within the node model.
      Throws:
      org.knime.core.node.InvalidSettingsException