how to validate if method argument belongs to a list of strings

hey guys. i have my service:
@Service
@Validated
public class ItemService {
    private ItemRepository itemRepository;
    public ItemService(ItemRepository itemRepository) {
        this.itemRepository = itemRepository;
    }
    public List<Item> getItemsByDistanceAndSeason(@Min(1) double distance, String season) {

        if (season.equals("all") || season.equals("winter") || season.equals("spring") || season.equals("summer") || season.equals("autumn")) {
            //then ok
        }

        return itemRepository.getAllByDistanceAndSeason(distance, season);
    }
}

and idk how to validate
Stringr season
argument. i want it to fall into a list of strings. i was thinking of making an enum and checking if argument falls into an enum. or maybe there are other more effective ways? thanks
Was this page helpful?