Package io.jmix.ui.component.validation
Class FutureValidator<T>
java.lang.Object
io.jmix.ui.component.validation.AbstractValidator<T>
io.jmix.ui.component.validation.FutureValidator<T>
- Type Parameters:
T
-Date
,LocalDate
,LocalDateTime
,LocalTime
,OffsetDateTime
,OffsetTime
@Component("ui_FutureValidator")
@Scope("prototype")
public class FutureValidator<T>
extends AbstractValidator<T>
Validates that date or time in the future.
Note, types that support TimeZones can be found in DateTimeTransformations.isDateTypeSupportsTimeZones(Class)
.
In order to provide your own implementation globally, create a subclass and register it in configuration class, for example:
@Bean("ui_FutureValidator") @Scope(BeanDefinition.SCOPE_PROTOTYPE) @Primary protected FutureValidator futureValidator() { return new CustomFutureValidator(); }
-
Field Summary
Fields inherited from class io.jmix.ui.component.validation.AbstractValidator
currentAuthentication, datatypeRegistry, message, messages, substitutor
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Checks a value.boolean
void
setCheckSeconds
(boolean checkSeconds) Set true if validator should also check seconds and nanos (if supported) in value.protected void
setMessages
(Messages messages) protected void
setTimeSource
(TimeSource timeSource) Methods inherited from class io.jmix.ui.component.validation.AbstractValidator
formatValue, getMessage, getTemplateErrorMessage, setMessage
-
Field Details
-
timeSource
-
checkSeconds
protected boolean checkSeconds
-
-
Constructor Details
-
FutureValidator
public FutureValidator() -
FutureValidator
Constructor for custom error message.- Parameters:
message
- error message
-
-
Method Details
-
setMessages
-
setTimeSource
-
setCheckSeconds
Set true if validator should also check seconds and nanos (if supported) in value. Default value is false.- Parameters:
checkSeconds
- check seconds
-
isCheckSeconds
public boolean isCheckSeconds()- Returns:
- true if seconds and nanos are checked
-
accept
Description copied from interface:Validator
Checks a value.- Parameters:
value
- a value- Throws:
ValidationException
-