public <T> T parseChoice(String val, List<T> validChoices) {
		for (T choice : validChoices) {
			if (choice.toString().equals(val)) {
				return choice;
			}
		}
		throw new IllegalArgumentException("Invalid choice: " + val);
	}
Parses a choice from a string.

@param val The string to parse.
@param validChoices An array of valid choices.
@return The choice
@throws IllegalArgumentException if the parsed string was not a valid choice.
Ghidra/Features/Base/src/main/java/ghidra/app/script/GhidraScript.java