Package org.eclipse.hono.util
Class ResourceLimitsPeriod
- java.lang.Object
-
- org.eclipse.hono.util.ResourceLimitsPeriod
-
public class ResourceLimitsPeriod extends Object
The period definition corresponding to a resource limit for a tenant.
-
-
Field Summary
Fields Modifier and Type Field Description static String
PERIOD_MODE_DAYS
The name of the constantly recurring accounting period mode.static String
PERIOD_MODE_MONTHLY
The name of the monthly recurring accounting period mode.
-
Constructor Summary
Constructors Constructor Description ResourceLimitsPeriod(String mode)
Creates a new instance with a given mode of recurrence.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getMode()
Gets the mode of period for resource limit calculation.int
getNoOfDays()
Gets the number of days for which resource usage is calculated.static boolean
isSupportedMode(String mode)
Checks if a given mode is one of the supported standard modes.ResourceLimitsPeriod
setNoOfDays(int noOfDays)
Sets the number of days for which resource usage is calculated.
-
-
-
Field Detail
-
PERIOD_MODE_DAYS
public static final String PERIOD_MODE_DAYS
The name of the constantly recurring accounting period mode.- See Also:
- Constant Field Values
-
PERIOD_MODE_MONTHLY
public static final String PERIOD_MODE_MONTHLY
The name of the monthly recurring accounting period mode.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ResourceLimitsPeriod
public ResourceLimitsPeriod(String mode)
Creates a new instance with a given mode of recurrence.- Parameters:
mode
- The mode of recurrence.- Throws:
NullPointerException
- if mode isnull
.
-
-
Method Detail
-
isSupportedMode
public static boolean isSupportedMode(String mode)
Checks if a given mode is one of the supported standard modes.- Parameters:
mode
- The mode to check.- Returns:
true
if the mode is one of the standard modes.
-
getMode
public final String getMode()
Gets the mode of period for resource limit calculation.- Returns:
- The mode of period for resource limit calculation.
-
getNoOfDays
public final int getNoOfDays()
Gets the number of days for which resource usage is calculated.- Returns:
- The number of days for a resource limit calculation.
-
setNoOfDays
public final ResourceLimitsPeriod setNoOfDays(int noOfDays)
Sets the number of days for which resource usage is calculated.- Parameters:
noOfDays
- The number of days for which resource usage is calculated.- Returns:
- a reference to this for fluent use.
- Throws:
IllegalArgumentException
- if the number of days is <= 0.
-
-