Package io.keikai.axyra.sheets.content
Class Validation.Builder
java.lang.Object
io.keikai.axyra.sheets.content.Validation.Builder
- Enclosing class:
- Validation
A fluent builder for a
Validation. Tokens are checked only when
the rule is applied with Range.setValidation, and an unknown
token is replaced, not rejected.
Validation rule = Validation.builder()
.type("decimal").operator("greaterThan").formula1("0")
.errorMessage("Invalid amount", "Enter a positive number.")
.build();
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionallowBlank(boolean b) Sets whether a blank cell passes the rule;trueby default.build()The immutable rule.errorMessage(String title, String message) Sets the error alert's title and text and turns the alert on.errorStyle(String style) Sets the alert style:stop(rejects the entry; the default),warningorinformation.Sets the first operand: a formula without a leading=, such as"10","$A$1","DATE(2020,1,1)"or, for a list,"\"A,B\""or"$X$1:$X$9".inputMessage(String title, String message) Sets the input hint's title and text and turns the hint on.Sets the comparison:between,notBetween,equal,notEqual,greaterThan,lessThan,greaterThanOrEqualorlessThanOrEqual.showDropdown(boolean b) Whether a list rule shows its in-cell drop-down arrow; shown when not set.showErrorMessage(boolean b) Whether a failure raises a message at all.showInputMessage(boolean b) Whether the input hint is shown when the cell is selected.Sets the validation type:whole,decimal,list,date,time,textLengthorcustom.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
type
Sets the validation type:whole,decimal,list,date,time,textLengthorcustom. An unknown token is not rejected; the rule then allows any value. -
operator
Sets the comparison:between,notBetween,equal,notEqual,greaterThan,lessThan,greaterThanOrEqualorlessThanOrEqual. An unknown or missing token is read asbetween. Ignored bylistandcustomrules. -
formula1
Sets the first operand: a formula without a leading=, such as"10","$A$1","DATE(2020,1,1)"or, for a list,"\"A,B\""or"$X$1:$X$9". The text is saved as is, so a leading=is kept and date text such as"2020-01-01"is read as arithmetic. -
formula2
-
allowBlank
Sets whether a blank cell passes the rule;trueby default. -
showDropdown
Whether a list rule shows its in-cell drop-down arrow; shown when not set. Ignored for other types. -
errorMessage
Sets the error alert's title and text and turns the alert on. -
errorStyle
Sets the alert style:stop(rejects the entry; the default),warningorinformation. An unknown token is read asstop. -
showErrorMessage
Whether a failure raises a message at all.Separate from
errorMessage(String, String), which implies it: a rule can validate silently, and there is no other way to say so. -
showInputMessage
Whether the input hint is shown when the cell is selected. -
inputMessage
Sets the input hint's title and text and turns the hint on. -
build
The immutable rule. Tokens are checked only when the rule is applied withRange.setValidation.
-