1
我有2 @StringDef s表示映射到颜色和球员如下:一个方法参数可以带多个@StringDef吗?
//Define the first @StringDef interface
@StringDef({X_COLOR , O_COLOR})
@Retention(RetentionPolicy.SOURCE)
public @interface ColorPreference{}
public static final String X_COLOR = "x_color";
public static final String O_COLOR = "O_color";
//Define the second @StringDef interface
@StringDef({PLAYER_X , PLAYER_Y})
@Retention(RetentionPolicy.SOURCE)
public @interface PlayerPreferences{};
public static final String PLAYER_X = "player_x";
public static final String PLAYER_Y = "player_y";
我想要实现保存到我的sharedPreferences是它可以是一个@ColorPreference或@PlayerPreference这样的方法:
public static void saveInPreferences(@ColorPreference || @PlayerPreference String value){}
这有可能以任何方式吗?