-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: use add all to make code simpler #96
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,11 +4,7 @@ | |
|
||
package io.modelcontextprotocol.server; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.*; | ||
import java.util.function.BiConsumer; | ||
import java.util.function.BiFunction; | ||
|
||
|
@@ -315,9 +311,7 @@ public AsyncSpecification tools(List<McpServerFeatures.AsyncToolSpecification> t | |
*/ | ||
public AsyncSpecification tools(McpServerFeatures.AsyncToolSpecification... toolSpecifications) { | ||
Assert.notNull(toolSpecifications, "Tool handlers list must not be null"); | ||
for (McpServerFeatures.AsyncToolSpecification tool : toolSpecifications) { | ||
this.tools.add(tool); | ||
} | ||
Collections.addAll(this.tools, toolSpecifications); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps |
||
return this; | ||
} | ||
|
||
|
@@ -413,9 +407,7 @@ public AsyncSpecification resourceTemplates(List<ResourceTemplate> resourceTempl | |
*/ | ||
public AsyncSpecification resourceTemplates(ResourceTemplate... resourceTemplates) { | ||
Assert.notNull(resourceTemplates, "Resource templates must not be null"); | ||
for (ResourceTemplate resourceTemplate : resourceTemplates) { | ||
this.resourceTemplates.add(resourceTemplate); | ||
} | ||
Collections.addAll(this.resourceTemplates, resourceTemplates); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same like above |
||
return this; | ||
} | ||
|
||
|
@@ -726,9 +718,7 @@ public SyncSpecification tools(List<McpServerFeatures.SyncToolSpecification> too | |
*/ | ||
public SyncSpecification tools(McpServerFeatures.SyncToolSpecification... toolSpecifications) { | ||
Assert.notNull(toolSpecifications, "Tool handlers list must not be null"); | ||
for (McpServerFeatures.SyncToolSpecification tool : toolSpecifications) { | ||
this.tools.add(tool); | ||
} | ||
Collections.addAll(this.tools, toolSpecifications); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||
return this; | ||
} | ||
|
||
|
@@ -824,9 +814,7 @@ public SyncSpecification resourceTemplates(List<ResourceTemplate> resourceTempla | |
*/ | ||
public SyncSpecification resourceTemplates(ResourceTemplate... resourceTemplates) { | ||
Assert.notNull(resourceTemplates, "Resource templates must not be null"); | ||
for (ResourceTemplate resourceTemplate : resourceTemplates) { | ||
this.resourceTemplates.add(resourceTemplate); | ||
} | ||
Collections.addAll(this.resourceTemplates, resourceTemplates); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||
return this; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wildcard imports are discouraged as they can lead to namespace pollution and make it harder to track dependencies.