Package org.apache.cassandra.config
Class DurationSpec.IntSecondsBound
- java.lang.Object
-
- org.apache.cassandra.config.DurationSpec
-
- org.apache.cassandra.config.DurationSpec.IntSecondsBound
-
- Enclosing class:
- DurationSpec
public static final class DurationSpec.IntSecondsBound extends DurationSpec
Represents a duration used for Cassandra configuration. The bound is [0, Integer.MAX_VALUE) in seconds. If the user sets a different unit - we still validate that converted to seconds the quantity will not exceed that upper bound. (CASSANDRA-17571)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.cassandra.config.DurationSpec
DurationSpec.IntMillisecondsBound, DurationSpec.IntMinutesBound, DurationSpec.IntSecondsBound, DurationSpec.LongMicrosecondsBound, DurationSpec.LongMillisecondsBound, DurationSpec.LongNanosecondsBound, DurationSpec.LongSecondsBound
-
-
Constructor Summary
Constructors Constructor Description IntSecondsBound(long seconds)
Creates aDurationSpec.IntSecondsBound
of the specified amount in seconds.IntSecondsBound(long quantity, java.util.concurrent.TimeUnit unit)
Creates aDurationSpec.IntSecondsBound
of the specified amount in the specified unit.IntSecondsBound(java.lang.String value)
Creates aDurationSpec.IntSecondsBound
of the specified amount.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DurationSpec.IntSecondsBound
inSecondsString(java.lang.String value)
Creates aDurationSpec.IntSecondsBound
of the specified amount in seconds, expressed either as the number of seconds without unit, or as a regular quantity with unit.int
toMilliseconds()
Returns this duration in number of milliseconds as anint
int
toNanoseconds()
Returns this duration in the number of nanoseconds as anint
int
toSeconds()
Returns this duration in number of seconds as anint
-
-
-
Constructor Detail
-
IntSecondsBound
public IntSecondsBound(java.lang.String value)
Creates aDurationSpec.IntSecondsBound
of the specified amount. The bound is [0, Integer.MAX_VALUE) in seconds. The bound is [0, Integer.MAX_VALUE) in seconds.- Parameters:
value
- the duration
-
IntSecondsBound
public IntSecondsBound(long quantity, java.util.concurrent.TimeUnit unit)
Creates aDurationSpec.IntSecondsBound
of the specified amount in the specified unit. The bound is [0, Integer.MAX_VALUE) in seconds.- Parameters:
quantity
- where quantity shouldn't be bigger than Integer.MAX_VALUE - 1 in secondsunit
- in which the provided quantity is
-
IntSecondsBound
public IntSecondsBound(long seconds)
Creates aDurationSpec.IntSecondsBound
of the specified amount in seconds. The bound is [0, Integer.MAX_VALUE) in seconds.- Parameters:
seconds
- where seconds shouldn't be bigger than Integer.MAX_VALUE-1
-
-
Method Detail
-
inSecondsString
public static DurationSpec.IntSecondsBound inSecondsString(java.lang.String value)
Creates aDurationSpec.IntSecondsBound
of the specified amount in seconds, expressed either as the number of seconds without unit, or as a regular quantity with unit. Used in the Converters for a few parameters which changed only type, but not names The bound is [0, Integer.MAX_VALUE) in seconds.- Parameters:
value
- where value shouldn't be bigger than Integer.MAX_VALUE-1 in seconds
-
toNanoseconds
public int toNanoseconds()
Returns this duration in the number of nanoseconds as anint
- Returns:
- this duration in number of nanoseconds or
Integer.MAX_VALUE
if the number of nanoseconds is too large.
-
toMilliseconds
public int toMilliseconds()
Returns this duration in number of milliseconds as anint
- Returns:
- this duration in number of milliseconds or
Integer.MAX_VALUE
if the number of milliseconds is too large.
-
toSeconds
public int toSeconds()
Returns this duration in number of seconds as anint
- Returns:
- this duration in number of seconds or
Integer.MAX_VALUE
if the number of seconds is too large.
-
-