Package org.eclipse.hono.util
Class DataVolume
- java.lang.Object
-
- org.eclipse.hono.util.DataVolume
-
public class DataVolume extends Object
Data volume definition of the tenant resource limits.
-
-
Constructor Summary
Constructors Constructor Description DataVolume()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Instant
getEffectiveSince()
Gets the point in time on which the data volume limit came into effect.long
getMaxBytes()
Gets the maximum number of bytes 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 data usage calculation.DataVolume
setEffectiveSince(Instant effectiveSince)
Sets the point in time on which the data volume limit came into effect.DataVolume
setMaxBytes(long maxBytes)
Sets the maximum number of bytes to be allowed for the time period defined by theTenantConstants.FIELD_PERIOD_MODE
andTenantConstants.FIELD_PERIOD_NO_OF_DAYS
.DataVolume
setPeriod(ResourceLimitsPeriod period)
Sets the period for the data usage calculation.
-
-
-
Method Detail
-
getEffectiveSince
public final Instant getEffectiveSince()
Gets the point in time on which the data volume limit came into effect.- Returns:
- The instant on which the data volume limit came into effective or
null
if not set.
-
setEffectiveSince
public final DataVolume setEffectiveSince(Instant effectiveSince)
Sets the point in time on which the data volume limit came into effect.- Parameters:
effectiveSince
- the point in time on which the data volume limit came into effect and it comply to theDateTimeFormatter.ISO_OFFSET_DATE_TIME
.- Returns:
- a reference to this for fluent use.
-
getMaxBytes
public final long getMaxBytes()
Gets the maximum number of bytes to be allowed for the time period defined by theTenantConstants.FIELD_PERIOD_MODE
andTenantConstants.FIELD_PERIOD_NO_OF_DAYS
.- Returns:
- The maximum number of bytes or
TenantConstants.UNLIMITED_BYTES
if not set.
-
setMaxBytes
public final DataVolume setMaxBytes(long maxBytes)
Sets the maximum number of bytes to be allowed for the time period defined by theTenantConstants.FIELD_PERIOD_MODE
andTenantConstants.FIELD_PERIOD_NO_OF_DAYS
.- Parameters:
maxBytes
- The maximum number of bytes to be allowed.- Returns:
- a reference to this for fluent use.
- Throws:
IllegalArgumentException
- if the maximum number of bytes is set to less than -1.
-
getPeriod
public final ResourceLimitsPeriod getPeriod()
Gets the period for the data usage calculation.- Returns:
- The period for the data usage calculation.
-
setPeriod
public final DataVolume setPeriod(ResourceLimitsPeriod period)
Sets the period for the data usage calculation.- Parameters:
period
- The period for the data usage calculation.- Returns:
- a reference to this for fluent use.
-
-