This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
/**
* 出题策略工厂类,根据role返回对应策略
*/
public class QuestionStrategyFactory {
public static QuestionStrategy getStrategy(String role) {
switch (role) {
case "小学":
return new ElementaryQuestionStrategy();
case "初中":
return new MiddleSchoolQuestionStrategy();
case "高中":
return new HighSchoolQuestionStrategy();
default:
throw new IllegalArgumentException("未知的角色: " + role);
}