public class ValidityPeriod extends Object implements ChangeCountable
| Constructor and Description |
|---|
ValidityPeriod()
Create a default ValidityPeriod where the period is not specified.
|
ValidityPeriod(double notBefore,
double notAfter)
Create a ValidityPeriod with the given period.
|
ValidityPeriod(ValidityPeriod validityPeriod)
Create a new ValidityPeriod with a copy of the fields in the given
validityPeriod.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
canGetFromSignature(Signature signature)
If the signature is a type that has a ValidityPeriod (so that
getFromSignature will succeed), return true.
|
void |
clear()
Reset to a default ValidityPeriod where the period is not specified.
|
boolean |
equals(Object other) |
boolean |
equals(ValidityPeriod other)
Check if this is the same validity period as other.
|
long |
getChangeCount()
Get the change count, which is incremented each time this object is changed.
|
static ValidityPeriod |
getFromSignature(Signature signature)
If the signature is a type that has a ValidityPeriod, then return it.
|
double |
getNotAfter()
Get the end of the validity period range.
|
double |
getNotBefore()
Get the beginning of the validity period range.
|
boolean |
hasPeriod()
Check if the period has been set.
|
boolean |
isValid()
Check if the current time falls within the validity period.
|
boolean |
isValid(double time)
Check if the time falls within the validity period.
|
ValidityPeriod |
setPeriod(double notBefore,
double notAfter)
Set the validity period.
|
public ValidityPeriod()
public ValidityPeriod(ValidityPeriod validityPeriod)
validityPeriod - The ValidityPeriod to copy.public ValidityPeriod(double notBefore,
double notAfter)
notBefore - The beginning of the validity period range as milliseconds
since Jan 1, 1970 UTC. Note that this is rounded up to the nearest whole
second.notAfter - The end of the validity period range as milliseconds
since Jan 1, 1970 UTC. Note that this is rounded down to the nearest whole
second.public final boolean hasPeriod()
public final double getNotBefore()
public final double getNotAfter()
public final void clear()
public final ValidityPeriod setPeriod(double notBefore, double notAfter)
notBefore - The beginning of the validity period range as milliseconds
since Jan 1, 1970 UTC. Note that this is rounded up to the nearest whole
second.notAfter - The end of the validity period range as milliseconds
since Jan 1, 1970 UTC. Note that this is rounded down to the nearest whole
second.public final boolean equals(ValidityPeriod other)
other - The other ValidityPeriod to compare with.public final boolean isValid(double time)
time - The time to check as milliseconds since Jan 1, 1970 UTC.public final boolean isValid()
public static boolean canGetFromSignature(Signature signature)
signature - An object of a subclass of Signature.public static ValidityPeriod getFromSignature(Signature signature)
signature - An object of a subclass of Signature.public final long getChangeCount()
getChangeCount in interface ChangeCountableCopyright © 2019. All rights reserved.