Package com.unboundid.util.args
Class TimestampRangeArgumentValueValidator
java.lang.Object
com.unboundid.util.args.ArgumentValueValidator
com.unboundid.util.args.TimestampRangeArgumentValueValidator
- All Implemented Interfaces:
Serializable
@NotMutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class TimestampRangeArgumentValueValidator
extends ArgumentValueValidator
implements Serializable
This class provides an implementation of an argument value validator that
ensures that values must be timestamps (parsable by the
TimestampArgument class) within a specified time range.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTimestampRangeArgumentValueValidator(Date oldestAllowedDate, Date mostRecentAllowedDate) Creates a new validator that will ensure that timestamp values are within the specified time range. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the most recent allowed date value that will be permitted by this validator.Retrieves the oldest allowed date value that will be permitted by this validator.toString()Retrieves a string representation of this argument value validator.voidtoString(StringBuilder buffer) Appends a string representation of this argument value validator to the provided buffer.voidvalidateArgumentValue(Argument argument, String valueString) Examines the value(s) assigned to the provided argument to determine whether they are acceptable.
-
Constructor Details
-
TimestampRangeArgumentValueValidator
public TimestampRangeArgumentValueValidator(@Nullable Date oldestAllowedDate, @Nullable Date mostRecentAllowedDate) Creates a new validator that will ensure that timestamp values are within the specified time range.- Parameters:
oldestAllowedDate- The oldest timestamp that will be accepted by this validator. It may benullif any timestamp older than the providedmostRecentAllowedDatewill be permitted.mostRecentAllowedDate- The most recent timestamp that will be accepted by this validator. It may benullif any timestamp more recent than the providedoldestAllowedDatewill be permitted.
-
-
Method Details
-
getOldestAllowedDate
Retrieves the oldest allowed date value that will be permitted by this validator.- Returns:
- The oldest allowed date value that will be permitted by this
validator, or
nullif any timestamp older than the most recent allowed date will be permitted.
-
getMostRecentAllowedDate
Retrieves the most recent allowed date value that will be permitted by this validator.- Returns:
- The most recent allowed date value that will be permitted by this
validator, or
nullif any timestamp newer than the oldest allowed date will be permitted.
-
validateArgumentValue
public void validateArgumentValue(@NotNull Argument argument, @NotNull String valueString) throws ArgumentException Examines the value(s) assigned to the provided argument to determine whether they are acceptable.- Specified by:
validateArgumentValuein classArgumentValueValidator- Parameters:
argument- The argument to which the value is being provided.valueString- The string representation of the value to be validated. This value will have already passed any normal validation performed by the argument.- Throws:
ArgumentException- If the provided value is determined to be unacceptable.
-
toString
Retrieves a string representation of this argument value validator. -
toString
Appends a string representation of this argument value validator to the provided buffer.- Parameters:
buffer- The buffer to which the string representation should be appended.
-