Package org.eclipse.hono.util
Class DataVolume
java.lang.Object
org.eclipse.hono.util.LimitedResource
org.eclipse.hono.util.DataVolume
Data volume definition of the tenant resource limits.
-
Constructor Summary
ConstructorDescriptionDataVolume
(Instant effectiveSince, ResourceLimitsPeriod period) Creates a new data volume specification for an instant in time and an accounting period definition.DataVolume
(Instant effectiveSince, ResourceLimitsPeriod period, long maxBytes) Creates a new data volume specification for an instant in time. -
Method Summary
Modifier and TypeMethodDescriptionfinal long
Gets the amount of data that devices of a tenant may transfer per accounting period.boolean
Checks if the amount of data that devices of a tenant may transfer per accounting period is limited.Methods inherited from class org.eclipse.hono.util.LimitedResource
getEffectiveSince, getElapsedAccountingPeriodDuration, getPeriod
-
Constructor Details
-
DataVolume
Creates a new data volume specification for an instant in time and an accounting period definition.- Parameters:
effectiveSince
- The point in time at which the limit became or will become effective.period
- The definition of the accounting periods to be used for this specification ornull
to use the default period definition with modeResourceLimitsPeriod.PeriodMode.monthly
.- Throws:
NullPointerException
- if effectiveSince isnull
.IllegalArgumentException
- if max bytes is < -1.
-
DataVolume
public DataVolume(@HonoTimestamp Instant effectiveSince, ResourceLimitsPeriod period, long maxBytes) Creates a new data volume specification for an instant in time.- Parameters:
effectiveSince
- The point in time at which the limit became or will become effective.period
- The definition of the accounting periods to be used for this specification ornull
to use the default period definition with modeResourceLimitsPeriod.PeriodMode.monthly
.maxBytes
- The amount of data (in bytes) that devices of a tenant may transfer per accounting period. The value -1L can be used to indicate that the data volume should not be limited.- Throws:
NullPointerException
- if effectiveSince isnull
.IllegalArgumentException
- if max bytes is < -1.
-
-
Method Details
-
getMaxBytes
public final long getMaxBytes()Gets the amount of data that devices of a tenant may transfer per accounting period.The default value of this property is -1L which indicates that the data volume is unlimited.
- Returns:
- The amount of data in bytes.
-
isLimited
public boolean isLimited()Checks if the amount of data that devices of a tenant may transfer per accounting period is limited.- Returns:
true
if the max bytes value is not -1L and the period mode is notResourceLimitsPeriod.PeriodMode.unknown
.
-