Interface ValidationContext<VIEWT>
- Type Parameters:
VIEWT- Type of the subtree or the value that is being validated.
public interface ValidationContext<VIEWT>
Validation context for the validators.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddIssue(ValidationIssue issue) Signifies that there's something wrong.Returns the key of validated node.<T> TReturns the updated view of the owner of the current value.<ROOT> ROOTgetNewRoot(RootKey<?, ROOT, ?> rootKey) Returns updated value of the configuration root.Returns updated value of the configuration.<T> TReturns a previous view of the owner of the current value.<ROOT> ROOTgetOldRoot(RootKey<?, ROOT, ?> rootKey) Returns previous value of the configuration root.Returns previous value of the configuration.
-
Method Details
-
currentKey
String currentKey()Returns the key of validated node.- Returns:
- String representation of currently validated value, i.e.
root.config.node.
-
getOldValue
Returns previous value of the configuration.- Returns:
- Previous value of the configuration. Might be
nullfor leaves only.
-
getNewValue
VIEWT getNewValue()Returns updated value of the configuration.- Returns:
- Updated value of the configuration. Cannot be
null.
-
getOldRoot
Returns previous value of the configuration root.- Type Parameters:
ROOT- Root view type derived from the root key.- Parameters:
rootKey- Root key.
-
getNewRoot
Returns updated value of the configuration root.- Type Parameters:
ROOT- Root view type derived from the root key.- Parameters:
rootKey- Root key.
-
addIssue
Signifies that there's something wrong. Values will be accumulated and passed to the user later.- Parameters:
issue- Validation issue object.- See Also:
-
getOldOwner
@Nullable <T> T getOldOwner()Returns a previous view of the owner of the current value.For primitives/nested configuration/named list, the owner is the configuration in which they are declared, for example
TableViewwill be returned for the string field,nullwill be returned for the root configuration.- Type Parameters:
T- Owner view type.
-
getNewOwner
@Nullable <T> T getNewOwner()Returns the updated view of the owner of the current value.For primitives/nested configuration/named list, the owner is the configuration in which they are declared, for example
TableViewwill be returned for the string field,nullwill be returned for the root configuration.- Type Parameters:
T- Owner view type.
-