File tree Expand file tree Collapse file tree
src/main/java/com/github/copilot/rpc Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55package com .github .copilot .rpc ;
66
7+ import com .fasterxml .jackson .annotation .JsonCreator ;
78import com .fasterxml .jackson .annotation .JsonValue ;
89
910/**
1314 * specific mode; defaults to the session's current mode when unset.
1415 *
1516 * @see MessageOptions
16- * @since 1.0 .0
17+ * @since 1.1 .0
1718 */
1819public enum AgentMode {
1920
@@ -44,4 +45,28 @@ public enum AgentMode {
4445 public String getValue () {
4546 return value ;
4647 }
48+
49+ /**
50+ * Deserializes a JSON string value into the corresponding {@code AgentMode}
51+ * enum constant.
52+ *
53+ * @param value
54+ * the JSON string value
55+ * @return the matching {@code AgentMode}, or {@code null} if value is
56+ * {@code null}
57+ * @throws IllegalArgumentException
58+ * if the value does not match any known agent mode
59+ */
60+ @ JsonCreator
61+ public static AgentMode fromValue (String value ) {
62+ if (value == null ) {
63+ return null ;
64+ }
65+ for (AgentMode mode : values ()) {
66+ if (mode .value .equals (value )) {
67+ return mode ;
68+ }
69+ }
70+ throw new IllegalArgumentException ("Unknown AgentMode: " + value );
71+ }
4772}
You can’t perform that action at this time.
0 commit comments