Class RandomToken

java.lang.Object
overit.geocall.util.RandomToken

public class RandomToken extends Object
The RandomToken object is a string of a given length, which is composed, in the creation phase of the object, by choosing random characters extracted from the desired alphabet. The class provides a series of pre-established alphabets: ALPHA_DIGIT, ALPHA, LOWERCASE_DIGIT, UPPERCASE_DIGIT, LOWERCASE, UPPERCASE, HEX
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected String
     
    protected String
     
    static final String
    Alphabet composed by uppercase characters and lowercase characters of the English alphabet
    static final String
    Alphabet composed by uppercase characters and lowercase characters of the English alphabet and the digits from 0 to 9
    static final String
    Alphabet composed by digits from 0 to 9
    static final String
    Alphabet composed by the characters that defines the hexadecimal notation, with uppercase characters from A to F and digits from 0 to 9
    static final String
    Alphabet composed by lowercase characters of the English alphabet
    static final String
    Alphabet composed by lowercase characters of the English alphabet and the digits from 0 to 9
    static final String
    Alphabet composed by uppercase characters of the English alphabet
    static final String
    Alphabet composed by uppercase characters of the English alphabet and the digits from 0 to 9
  • Constructor Summary

    Constructors
    Constructor
    Description
    RandomToken(String alphabet, int size)
    Generate a random sequence of fixed size string.
  • Method Summary

    Modifier and Type
    Method
    Description
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • ALPHA_DIGIT

      public static final String ALPHA_DIGIT
      Alphabet composed by uppercase characters and lowercase characters of the English alphabet and the digits from 0 to 9
      See Also:
    • ALPHA

      public static final String ALPHA
      Alphabet composed by uppercase characters and lowercase characters of the English alphabet
      See Also:
    • LOWERCASE_DIGIT

      public static final String LOWERCASE_DIGIT
      Alphabet composed by lowercase characters of the English alphabet and the digits from 0 to 9
      See Also:
    • UPPERCASE_DIGIT

      public static final String UPPERCASE_DIGIT
      Alphabet composed by uppercase characters of the English alphabet and the digits from 0 to 9
      See Also:
    • LOWERCASE

      public static final String LOWERCASE
      Alphabet composed by lowercase characters of the English alphabet
      See Also:
    • UPPERCASE

      public static final String UPPERCASE
      Alphabet composed by uppercase characters of the English alphabet
      See Also:
    • HEX

      public static final String HEX
      Alphabet composed by the characters that defines the hexadecimal notation, with uppercase characters from A to F and digits from 0 to 9
      See Also:
    • DIGIT

      public static final String DIGIT
      Alphabet composed by digits from 0 to 9
      See Also:
    • _token

      protected String _token
    • _code

      protected String _code
  • Constructor Details

    • RandomToken

      public RandomToken(String alphabet, int size)
      Generate a random sequence of fixed size string. The token will be generated using only the characters contained in the given alphabet.
      Parameters:
      alphabet - string containing the characters that will be used to compose the random string. Generally you can pass one of the following constants:
      size - the length of the random string
  • Method Details