Class AccessTokenExpirationDateComparator

  • All Implemented Interfaces:
    java.util.Comparator<AccessToken>

    public class AccessTokenExpirationDateComparator
    extends BasicComparator<AccessToken>
    A Comparator implementation that compares two AccessToken on their expiration Date objects and orders them such that past dates come before future dates.

    This Comparator considers non-null values to be greater than any null date. Hence, non-null dates will be sorted to the end of the list.

    Since:
    jcms-10.0.8
    Author:
    Sylvain Devaux
    • Constructor Detail

      • AccessTokenExpirationDateComparator

        public AccessTokenExpirationDateComparator()
    • Method Detail

      • compare

        public int compare​(AccessToken p1,
                           AccessToken p2)
        Compares two Dates in ascending order.
        Specified by:
        compare in interface java.util.Comparator<AccessToken>
        Overrides:
        compare in class BasicStorable.CdateComparator<AccessToken>
        Parameters:
        p1 - the first token with expiration date d1
        p2 - the second token with expiration date d2
        Returns:
        -1, 0 or 1 if d1 is lower than, equals or greater than d2