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
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
ConstructorsConstructorDescriptionIntSecondsBound(long seconds) Creates aDurationSpec.IntSecondsBoundof the specified amount in seconds.IntSecondsBound(long quantity, TimeUnit unit) Creates aDurationSpec.IntSecondsBoundof the specified amount in the specified unit.IntSecondsBound(String value) Creates aDurationSpec.IntSecondsBoundof the specified amount. -
Method Summary
Modifier and TypeMethodDescriptionstatic DurationSpec.IntSecondsBoundinSecondsString(String value) Creates aDurationSpec.IntSecondsBoundof the specified amount in seconds, expressed either as the number of seconds without unit, or as a regular quantity with unit.intReturns this duration in number of milliseconds as anintintReturns this duration in the number of nanoseconds as anintintReturns this duration in number of seconds as anint
-
Constructor Details
-
IntSecondsBound
Creates aDurationSpec.IntSecondsBoundof 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
Creates aDurationSpec.IntSecondsBoundof 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.IntSecondsBoundof 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 Details
-
inSecondsString
Creates aDurationSpec.IntSecondsBoundof 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_VALUEif 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_VALUEif 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_VALUEif the number of seconds is too large.
-