Package com.peterphi.std.types
Class SimpleId
java.lang.Object
com.peterphi.std.types.Id
com.peterphi.std.types.SimpleId
- All Implemented Interfaces:
Serializable,Comparable<Id>
A simple, untyped Id field; this is one step above having a String id
It is recommended that users extend Id themselves rather than using this type (as a SimpleId adds no discernable information about what the id is for)
It is recommended that users extend Id themselves rather than using this type (as a SimpleId adds no discernable information about what the id is for)
- See Also:
-
Field Summary
Fields inherited from class com.peterphi.std.types.Id
id, SANITY_CHECK -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final Stringalphanumeric(int length) Generates a random sequence of alphanumeric characters of lengthlengthusing a new pseudorandom number generator (new Random())static final Stringalphanumeric(String prefix, int totalLength) Generates a random sequence of alphanumeric characters, prefixed byprefixsuch that the total string is of lengthtotalLengthusing a new pseudorandom number generator (new Random())static final Stringalphanumeric(Random random, int length) Generates a random sequence of alphanumeric characters of lengthlengthusing the provided random number generatorstatic SimpleIdrandom()Return an Id which uses 32 random alphanumeric characters as its value
-
Constructor Details
-
SimpleId
- Parameters:
id-
-
SimpleId
-
-
Method Details
-
random
Return an Id which uses 32 random alphanumeric characters as its value- Returns:
-
alphanumeric
Generates a random sequence of alphanumeric characters of lengthlengthusing a new pseudorandom number generator (new Random())- Parameters:
length- the length of the string to generate (must be > 0)- Returns:
- a new random alphanumeric String of length
length
-
alphanumeric
Generates a random sequence of alphanumeric characters, prefixed byprefixsuch that the total string is of lengthtotalLengthusing a new pseudorandom number generator (new Random())- Parameters:
totalLength- the length of the string to return (must be > the prefix length)- Returns:
- a String of length
length
-
alphanumeric
Generates a random sequence of alphanumeric characters of lengthlengthusing the provided random number generator- Parameters:
random- the random number generator to use (must not be null)length- the length of the string to generate (must be > 0)- Returns:
- a new random alphanumeric String of length
length
-