Class PeriodGranularity

  • All Implemented Interfaces:
    com.fasterxml.jackson.databind.JsonSerializable, Cacheable

    public class PeriodGranularity
    extends Granularity
    implements com.fasterxml.jackson.databind.JsonSerializable
    PeriodGranularity buckets data based on any custom time period
    • Constructor Detail

      • PeriodGranularity

        public PeriodGranularity​(org.joda.time.Period period,
                                 org.joda.time.DateTime origin,
                                 org.joda.time.DateTimeZone tz)
    • Method Detail

      • getPeriod

        public org.joda.time.Period getPeriod()
      • getOrigin

        @Nullable
        public org.joda.time.DateTime getOrigin()
      • increment

        public org.joda.time.DateTime increment​(org.joda.time.DateTime time)
        Specified by:
        increment in class Granularity
      • bucketStart

        public org.joda.time.DateTime bucketStart​(org.joda.time.DateTime time)
        Specified by:
        bucketStart in class Granularity
      • isAligned

        public boolean isAligned​(org.joda.time.Interval interval)
        Description copied from class: Granularity
        Return true only if the time chunks populated by this granularity includes the given interval time chunk. The interval must fit exactly into the scheme of the granularity for this to return true
        Specified by:
        isAligned in class Granularity
      • getCacheKey

        public byte[] getCacheKey()
        Description copied from interface: Cacheable
        Get a byte array used as a cache key.
        Specified by:
        getCacheKey in interface Cacheable
        Returns:
        a cache key
      • toDateTime

        public org.joda.time.DateTime toDateTime​(long offset)
        Overrides:
        toDateTime in class Granularity
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • serialize

        public void serialize​(com.fasterxml.jackson.core.JsonGenerator jsonGenerator,
                              com.fasterxml.jackson.databind.SerializerProvider serializerProvider)
                       throws IOException
        Specified by:
        serialize in interface com.fasterxml.jackson.databind.JsonSerializable
        Throws:
        IOException
      • serializeWithType

        public void serializeWithType​(com.fasterxml.jackson.core.JsonGenerator jsonGenerator,
                                      com.fasterxml.jackson.databind.SerializerProvider serializerProvider,
                                      com.fasterxml.jackson.databind.jsontype.TypeSerializer typeSerializer)
                               throws IOException
        Specified by:
        serializeWithType in interface com.fasterxml.jackson.databind.JsonSerializable
        Throws:
        IOException