Package org.apereo.cas.util.gen
Class DefaultLongNumericGenerator
- java.lang.Object
-
- org.apereo.cas.util.gen.DefaultLongNumericGenerator
-
- All Implemented Interfaces:
LongNumericGenerator,NumericGenerator
public class DefaultLongNumericGenerator extends java.lang.Object implements LongNumericGenerator
The default numeric generator for generating long values. Implementation allows for wrapping (to restart count) if the maximum is reached.- Since:
- 3.0.0
-
-
Constructor Summary
Constructors Constructor Description DefaultLongNumericGenerator()Instantiates a new default long numeric generator.DefaultLongNumericGenerator(long initialValue)Instantiates a new default long numeric generator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetNextLong()Get the next long in the sequence.java.lang.StringgetNextNumberAsString()Method to retrieve the next number as a String.protected longgetNextValue()Gets the next value.intmaxLength()The guaranteed maximum length of a String returned by this generator.intminLength()The guaranteed minimum length of a String returned by this generator.
-
-
-
Constructor Detail
-
DefaultLongNumericGenerator
public DefaultLongNumericGenerator()
Instantiates a new default long numeric generator.
-
DefaultLongNumericGenerator
public DefaultLongNumericGenerator(long initialValue)
Instantiates a new default long numeric generator.- Parameters:
initialValue- the initial value
-
-
Method Detail
-
getNextLong
public long getNextLong()
Description copied from interface:LongNumericGeneratorGet the next long in the sequence.- Specified by:
getNextLongin interfaceLongNumericGenerator- Returns:
- the next long in the sequence.
-
getNextNumberAsString
public java.lang.String getNextNumberAsString()
Description copied from interface:NumericGeneratorMethod to retrieve the next number as a String.- Specified by:
getNextNumberAsStringin interfaceNumericGenerator- Returns:
- the String representation of the next number in the sequence
-
maxLength
public int maxLength()
Description copied from interface:NumericGeneratorThe guaranteed maximum length of a String returned by this generator.- Specified by:
maxLengthin interfaceNumericGenerator- Returns:
- the maximum length
-
minLength
public int minLength()
Description copied from interface:NumericGeneratorThe guaranteed minimum length of a String returned by this generator.- Specified by:
minLengthin interfaceNumericGenerator- Returns:
- the minimum length.
-
getNextValue
protected long getNextValue()
Gets the next value.- Returns:
- the next value. If the count has reached
Long.MAX_VALUE, thenLong.MAX_VALUEis returned. Otherwise, the next increment.
-
-