Class TTL


  • public class TTL
    extends Object

    The utility class used for setting the TTL header field.

    Example:
     // Suggests that the push message is retained for 2 days.
     myHeader.addHeader("TTL", TTL.days(2));
     
    Author:
    Tomoki Sato
    • Field Detail

      • HEADER_NAME

        public static String HEADER_NAME
        The name of the TTL header field.
    • Method Detail

      • days

        public static long days​(long days)
        Convert the given TTL in days to seconds.
        Parameters:
        days - the TTL in days(how many days a push message is retained by the push service).
        Returns:
        the TTL in seconds.
        Throws:
        IllegalArgumentException - if the given days is negative.
      • hours

        public static long hours​(long hours)
        Convert the given TTL in hours to seconds.
        Parameters:
        hours - the TTL in hours(how many hours a push message is retained by the push service).
        Returns:
        the TTL in seconds.
        Throws:
        IllegalArgumentException - if the given hours is negative.
      • minutes

        public static long minutes​(long minutes)
        Convert the given TTL in minutes to seconds.
        Parameters:
        minutes - the TTL in minutes (how many minutes a push message is retained by the push service).
        Returns:
        the TTL in seconds.
        Throws:
        IllegalArgumentException - if the given minutes is negative.
      • seconds

        public static long seconds​(long seconds)
        Check if the given TTL in seconds isn't negative.
        Parameters:
        seconds - the TTL in seconds (how many seconds a push message is retained by the push service).
        Returns:
        the given seconds.
        Throws:
        IllegalArgumentException - if the given seconds is negative.