66
77import java .util .List ;
88import java .util .Map ;
9+ import java .util .Objects ;
910import java .util .concurrent .CompletableFuture ;
1011import java .util .concurrent .Executor ;
1112import java .util .function .Supplier ;
@@ -121,7 +122,7 @@ public String[] getCliArgs() {
121122 * @return this options instance for method chaining
122123 */
123124 public CopilotClientOptions setCliArgs (String [] cliArgs ) {
124- this .cliArgs = cliArgs ;
125+ this .cliArgs = Objects . requireNonNull ( cliArgs , "cliArgs must not be null" ) ;
125126 return this ;
126127 }
127128
@@ -138,12 +139,11 @@ public String getCliPath() {
138139 * Sets the path to the Copilot CLI executable.
139140 *
140141 * @param cliPath
141- * the path to the CLI executable, or {@code null} to use "copilot"
142- * from PATH
142+ * the path to the CLI executable
143143 * @return this options instance for method chaining
144144 */
145145 public CopilotClientOptions setCliPath (String cliPath ) {
146- this .cliPath = cliPath ;
146+ this .cliPath = Objects . requireNonNull ( cliPath , "cliPath must not be null" ) ;
147147 return this ;
148148 }
149149
@@ -170,7 +170,7 @@ public String getCliUrl() {
170170 * @return this options instance for method chaining
171171 */
172172 public CopilotClientOptions setCliUrl (String cliUrl ) {
173- this .cliUrl = cliUrl ;
173+ this .cliUrl = Objects . requireNonNull ( cliUrl , "cliUrl must not be null" ) ;
174174 return this ;
175175 }
176176
@@ -191,7 +191,7 @@ public String getCwd() {
191191 * @return this options instance for method chaining
192192 */
193193 public CopilotClientOptions setCwd (String cwd ) {
194- this .cwd = cwd ;
194+ this .cwd = Objects . requireNonNull ( cwd , "cwd must not be null" ) ;
195195 return this ;
196196 }
197197
@@ -214,7 +214,7 @@ public Map<String, String> getEnvironment() {
214214 * @return this options instance for method chaining
215215 */
216216 public CopilotClientOptions setEnvironment (Map <String , String > environment ) {
217- this .environment = environment ;
217+ this .environment = Objects . requireNonNull ( environment , "environment must not be null" ) ;
218218 return this ;
219219 }
220220
@@ -237,11 +237,11 @@ public Executor getExecutor() {
237237 * onto a dedicated thread pool or integrate with container-managed threading.
238238 *
239239 * @param executor
240- * the executor to use, or {@code null} for the default
240+ * the executor to use
241241 * @return this options instance for fluent chaining
242242 */
243243 public CopilotClientOptions setExecutor (Executor executor ) {
244- this .executor = executor ;
244+ this .executor = Objects . requireNonNull ( executor , "executor must not be null" ) ;
245245 return this ;
246246 }
247247
@@ -265,7 +265,7 @@ public String getGitHubToken() {
265265 * @return this options instance for method chaining
266266 */
267267 public CopilotClientOptions setGitHubToken (String gitHubToken ) {
268- this .gitHubToken = gitHubToken ;
268+ this .gitHubToken = Objects . requireNonNull ( gitHubToken , "gitHubToken must not be null" ) ;
269269 return this ;
270270 }
271271
@@ -290,7 +290,7 @@ public String getGithubToken() {
290290 */
291291 @ Deprecated
292292 public CopilotClientOptions setGithubToken (String githubToken ) {
293- this .gitHubToken = githubToken ;
293+ this .gitHubToken = Objects . requireNonNull ( githubToken , "githubToken must not be null" ) ;
294294 return this ;
295295 }
296296
@@ -313,7 +313,7 @@ public String getLogLevel() {
313313 * @return this options instance for method chaining
314314 */
315315 public CopilotClientOptions setLogLevel (String logLevel ) {
316- this .logLevel = logLevel ;
316+ this .logLevel = Objects . requireNonNull ( logLevel , "logLevel must not be null" ) ;
317317 return this ;
318318 }
319319
@@ -338,7 +338,7 @@ public Supplier<CompletableFuture<List<ModelInfo>>> getOnListModels() {
338338 * @return this options instance for method chaining
339339 */
340340 public CopilotClientOptions setOnListModels (Supplier <CompletableFuture <List <ModelInfo >>> onListModels ) {
341- this .onListModels = onListModels ;
341+ this .onListModels = Objects . requireNonNull ( onListModels , "onListModels must not be null" ) ;
342342 return this ;
343343 }
344344
@@ -378,16 +378,16 @@ public TelemetryConfig getTelemetry() {
378378 /**
379379 * Sets the OpenTelemetry configuration for the CLI server.
380380 * <p>
381- * When set to a non-{@code null} value , the CLI server is started with
382- * OpenTelemetry instrumentation enabled using the provided settings.
381+ * When set, the CLI server is started with OpenTelemetry instrumentation
382+ * enabled using the provided settings.
383383 *
384384 * @param telemetry
385385 * the telemetry configuration
386386 * @return this options instance for method chaining
387387 * @since 1.2.0
388388 */
389389 public CopilotClientOptions setTelemetry (TelemetryConfig telemetry ) {
390- this .telemetry = telemetry ;
390+ this .telemetry = Objects . requireNonNull ( telemetry , "telemetry must not be null" ) ;
391391 return this ;
392392 }
393393
0 commit comments