Class IdManager

java.lang.Object
collectionManagers.IdManager

public class IdManager extends Object
Class for managing object's id's
  • Constructor Details

    • IdManager

      public IdManager()
  • Method Details

    • checkCityById

      public static City checkCityById(Long id)
      Checks if a City object with the given ID exists in the collection, and if so, returns it
      Parameters:
      id - the ID to check
      Returns:
      the City object with the specified ID if it exists, otherwise null
    • generateId

      public static Long generateId()
      Generates a unique ID that has not been previously generated and stores it in the queue
      Returns:
      the unique ID that was generated
    • isNotNumeric

      public static boolean isNotNumeric(String str)
      Checks if a given string is not numeric
      Parameters:
      str - the string to check
      Returns:
      true if the string is not numeric, false otherwise
    • validateUserInput

      public static Long validateUserInput(String input)
      Validates user input for ID fields and returns the parsed ID if it is valid
      Parameters:
      input - the user input to validate
      Returns:
      the parsed ID if it is valid, otherwise null