net.ripe.rpki.commons.crypto
Class ValidityPeriod

java.lang.Object
  extended by net.ripe.rpki.commons.util.EqualsSupport
      extended by 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
ValidityPeriod()
           
ValidityPeriod(Date notValidBefore, Date notValidAfter)
           
ValidityPeriod(org.joda.time.ReadableInstant notValidBefore, org.joda.time.ReadableInstant notValidAfter)
           
 
Method Summary
 boolean contains(ValidityPeriod other)
           
 org.joda.time.DateTime getNotValidAfter()
           
 org.joda.time.DateTime getNotValidBefore()
           
 ValidityPeriod intersectedWith(ValidityPeriod other)
          Calculates the intersection of two validity periods, taking into account open-ended validity periods.
 boolean isClosed()
           
 boolean isExpiredAt(org.joda.time.ReadableInstant instant)
           
 boolean isExpiredNow()
           
 boolean isValidAt(org.joda.time.ReadableInstant instant)
           
 boolean isValidNow()
           
 String toString()
           
 ValidityPeriod withNotValidAfter(org.joda.time.ReadableInstant notValidAfter)
           
 ValidityPeriod withNotValidBefore(org.joda.time.ReadableInstant notValidBefore)
           
 
Methods inherited from class net.ripe.rpki.commons.util.EqualsSupport
equals, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ValidityPeriod

public ValidityPeriod()

ValidityPeriod

public ValidityPeriod(org.joda.time.ReadableInstant notValidBefore,
                      org.joda.time.ReadableInstant notValidAfter)

ValidityPeriod

public ValidityPeriod(Date notValidBefore,
                      Date notValidAfter)
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:
toString in class EqualsSupport


Copyright © 2008-2014 RIPE NCC, the Netherlands. All Rights Reserved.