Class DateIntervalWrapper

  • All Implemented Interfaces:
    Writeable, ToXContent, ToXContentFragment

    public class DateIntervalWrapper
    extends java.lang.Object
    implements ToXContentFragment, Writeable
    A class that handles all the parsing, bwc and deprecations surrounding date histogram intervals. - Provides parser helpers for the deprecated interval/dateHistogramInterval parameters. - Provides parser helpers for the new calendar/fixed interval parameters - Can read old intervals from a stream and convert to new intervals - Can write new intervals to old format when streaming out - Provides a variety of helper methods to interpret the intervals as different types, depending on caller's need After the deprecated parameters are removed, this class can be simplified greatly. The legacy options will be removed, and the mutual-exclusion checks can be done in the setters directly removing the need for the enum and the complicated "state machine" logic