Package org.cytoscape.work
Interface TunableValidator
-
public interface TunableValidatorIf implemented, this interface is used to apply a test to the modified values of a Tunable.Example: If using this Test class :The String message returned bypublic class Test {@Tunable(...)String name = "John"; } Then we can provide a method to check if the new value for this tunable matches with the conditions that we have set : public class Test implements TunableValidator{@Tunable(...)String name = new String("John"); ValidationState getValidationState(Appendable message){ if (name == null || name.isEmpty()) { message.append("Name not specified!"); return INVALID; } else if (name.equals("Johnny")) { message.append("Are you sure you want to use a nickname?"); return REQUEST_CONFIRMATION; } else { return OK; } } }validate()method is displayed to the user.Module:
work-apiTo use this in your app, include the following dependency in your POM:
<dependency> <groupId>org.cytoscape</groupId> <artifactId>work-api</artifactId> </dependency>
Cytoscape Backwards Compatibility (SPI Interface): We expect that this interface will be implemented. Therefore to maintain backwards compatibility this interface will only be modified for major version updates.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classTunableValidator.ValidationStateThe states the the validator can return.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TunableValidator.ValidationStategetValidationState(Appendable errMsg)Executes the validation test on the annotatedTunables.
-
-
-
Method Detail
-
getValidationState
TunableValidator.ValidationState getValidationState(Appendable errMsg)
Executes the validation test on the annotatedTunables.- Parameters:
errMsg- if the validation failed an explanatory message can be found here and accessed viaerrMsg.toString()- Returns:
- OK if the test succeeded and INVALID if it failed and REQUEST_CONFIRMATION if the user has to be asked for confirmation, e.g. if a file would have to be overwritten etc.
-
-