Package org.eclipse.hono.util
Class ConnectionDuration
- java.lang.Object
-
- org.eclipse.hono.util.ConnectionDuration
-
public class ConnectionDuration extends Object
The resource limits definition corresponding to the connection duration.
-
-
Constructor Summary
Constructors Constructor Description ConnectionDuration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Instant
getEffectiveSince()
Gets the point in time on which the connection duration limit came into effect.long
getMaxMinutes()
Gets the maximum device connection duration in minutes to be allowed for the time period defined by theTenantConstants.FIELD_PERIOD_MODE
andTenantConstants.FIELD_PERIOD_NO_OF_DAYS
.ResourceLimitsPeriod
getPeriod()
Gets the period for the connection duration calculation.ConnectionDuration
setEffectiveSince(Instant effectiveSince)
Sets the point in time on which the connection duration limit came into effect.ConnectionDuration
setMaxDuration(long maxMinutes)
Sets the maximum device connection duration in minutes to be allowed for the time period defined by theTenantConstants.FIELD_PERIOD_MODE
andTenantConstants.FIELD_PERIOD_NO_OF_DAYS
.ConnectionDuration
setPeriod(ResourceLimitsPeriod period)
Sets the period for the connection duration calculation.
-
-
-
Method Detail
-
getEffectiveSince
public final Instant getEffectiveSince()
Gets the point in time on which the connection duration limit came into effect.- Returns:
- The instant on which the connection duration limit came into effective or
null
if not set.
-
setEffectiveSince
public final ConnectionDuration setEffectiveSince(Instant effectiveSince)
Sets the point in time on which the connection duration limit came into effect.- Parameters:
effectiveSince
- the point in time on which the connection duration limit came into effect and it comply to theDateTimeFormatter.ISO_OFFSET_DATE_TIME
.- Returns:
- a reference to this for fluent use.
- Throws:
NullPointerException
- if effectiveSince isnull
.
-
getMaxMinutes
public final long getMaxMinutes()
Gets the maximum device connection duration in minutes to be allowed for the time period defined by theTenantConstants.FIELD_PERIOD_MODE
andTenantConstants.FIELD_PERIOD_NO_OF_DAYS
.- Returns:
- The maximum connection duration in minutes or
TenantConstants.UNLIMITED_MINUTES
if not set.
-
setMaxDuration
public final ConnectionDuration setMaxDuration(long maxMinutes)
Sets the maximum device connection duration in minutes to be allowed for the time period defined by theTenantConstants.FIELD_PERIOD_MODE
andTenantConstants.FIELD_PERIOD_NO_OF_DAYS
.- Parameters:
maxMinutes
- The maximum connection duration in minutes to be allowed.- Returns:
- a reference to this for fluent use.
- Throws:
IllegalArgumentException
- if the maximum number of minutes is set to less thanTenantConstants.UNLIMITED_MINUTES
.
-
getPeriod
public final ResourceLimitsPeriod getPeriod()
Gets the period for the connection duration calculation.- Returns:
- The period for the connection duration calculation.
-
setPeriod
public final ConnectionDuration setPeriod(ResourceLimitsPeriod period)
Sets the period for the connection duration calculation.- Parameters:
period
- The period for the connection duration calculation.- Returns:
- a reference to this for fluent use.
- Throws:
NullPointerException
- if period isnull
.
-
-