Package net.ripe.rpki.commons.crypto
Class ValidityPeriod
- java.lang.Object
-
- net.ripe.rpki.commons.util.EqualsSupport
-
- net.ripe.rpki.commons.crypto.ValidityPeriod
-
- All Implemented Interfaces:
Serializable
public class ValidityPeriod extends EqualsSupport implements Serializable
Validity period used by the certification system. Since certificates only have up-to second accuracy with validity fields, this class truncates not before and not after to second accuracy.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ValidityPeriod()ValidityPeriod(Date notValidBefore, Date notValidAfter)ValidityPeriod(org.joda.time.ReadableInstant notValidBefore, org.joda.time.ReadableInstant notValidAfter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(ValidityPeriod other)org.joda.time.DateTimegetNotValidAfter()org.joda.time.DateTimegetNotValidBefore()ValidityPeriodintersectedWith(ValidityPeriod other)Calculates the intersection of two validity periods, taking into account open-ended validity periods.booleanisClosed()booleanisExpiredAt(org.joda.time.ReadableInstant instant)booleanisExpiredNow()booleanisValidAt(org.joda.time.ReadableInstant instant)booleanisValidNow()StringtoString()ValidityPeriodwithNotValidAfter(org.joda.time.ReadableInstant notValidAfter)ValidityPeriodwithNotValidBefore(org.joda.time.ReadableInstant notValidBefore)-
Methods inherited from class net.ripe.rpki.commons.util.EqualsSupport
equals, hashCode
-
-
-
-
Method Detail
-
getNotValidAfter
public org.joda.time.DateTime getNotValidAfter()
-
getNotValidBefore
public org.joda.time.DateTime getNotValidBefore()
-
withNotValidBefore
public ValidityPeriod withNotValidBefore(org.joda.time.ReadableInstant notValidBefore)
-
withNotValidAfter
public ValidityPeriod withNotValidAfter(org.joda.time.ReadableInstant notValidAfter)
-
contains
public boolean contains(ValidityPeriod other)
-
isExpiredNow
public boolean isExpiredNow()
-
isExpiredAt
public boolean isExpiredAt(org.joda.time.ReadableInstant instant)
-
isValidNow
public boolean isValidNow()
-
isValidAt
public boolean isValidAt(org.joda.time.ReadableInstant instant)
-
isClosed
public boolean isClosed()
- Returns:
- true if this instances notValidBefore and notValidAfter are both specified.
-
intersectedWith
public ValidityPeriod intersectedWith(ValidityPeriod other)
Calculates the intersection of two validity periods, taking into account open-ended validity periods.- Parameters:
other- the validity period to intersect with.- Returns:
- the intersection of this and the other validity period, or null if there is no overlap.
-
toString
public String toString()
- Overrides:
toStringin classEqualsSupport
-
-