Package collectionManagers
Class IdManager
java.lang.Object
collectionManagers.IdManager
Class for managing object's id's
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CitycheckCityById(Long id) Checks if a City object with the given ID exists in the collection, and if so, returns itstatic LongGenerates a unique ID that has not been previously generated and stores it in the queuestatic booleanisNotNumeric(String str) Checks if a given string is not numericstatic LongvalidateUserInput(String input) Validates user input for ID fields and returns the parsed ID if it is valid
-
Constructor Details
-
IdManager
public IdManager()
-
-
Method Details
-
checkCityById
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
Generates a unique ID that has not been previously generated and stores it in the queue- Returns:
- the unique ID that was generated
-
isNotNumeric
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
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
-