public interface TunableValidator
Example:
If using this Test class :
public 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;
}
}
}
The String message returned by validate()
method is displayed to the user.Module: work-api
To use this in your app, include the following dependency in your POM:
<dependency> <groupId>org.cytoscape</groupId> <artifactId>work-api</artifactId> </dependency>
Modifier and Type | Interface and Description |
---|---|
static class |
TunableValidator.ValidationState
The states the the validator can return.
|
Modifier and Type | Method and Description |
---|---|
TunableValidator.ValidationState |
getValidationState(Appendable errMsg)
Executes the validation test on the annotated
Tunables . |
TunableValidator.ValidationState getValidationState(Appendable errMsg)
Tunables
.errMsg
- if the validation failed an explanatory message can be found here and accessed via
errMsg.toString()
Copyright 2011-2015 Cytoscape Consortium. All rights reserved.