io.keen.client.java.AbsoluteTimeframe Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of keen-client-api-query Show documentation
Show all versions of keen-client-api-query Show documentation
Java Query Client API for Keen IO
package io.keen.client.java;
import java.util.HashMap;
import java.util.Map;
/**
* AbsoluteTimeframe allows users to construct a Timeframe with
* start and end dates and times. Please refer to: https://keen.io/docs/api/#absolute-timeframes
*
* @author claireyoung
* @since 1.0.0
*
*/
public class AbsoluteTimeframe implements Timeframe {
private final String start;
private final String end;
/**
* Construct an AbsoluteTimeframe with a specified start and end date/time.
* @param start the start time
* @param end the end time
*/
public AbsoluteTimeframe(String start, String end) {
this.start = start;
this.end = end;
}
/**
* Get the Start date/time timeframe.
*
* @return the start date/time.
*/
public String getStart() { return start; }
/**
* Get the End date/time timeframe.
*
* @return the end date/time.
*/
public String getEnd() { return end; }
/**
* Construct the Timeframe map to send in the query.
*
* @return the Timeframe Json map to send in the query.
*/
@Override
public Map constructTimeframeArgs() {
Map timeframe = null;
if (start != null && end != null) {
Map absoluteTimeframe = new HashMap(3);
absoluteTimeframe.put(KeenQueryConstants.START, start);
absoluteTimeframe.put(KeenQueryConstants.END, end);
timeframe = new HashMap(2);
timeframe.put(KeenQueryConstants.TIMEFRAME, absoluteTimeframe);
return timeframe;
}
return timeframe;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy