Revert removed builders for Resource and ResourceTemplate (#947)
Instead of fully breaking the API, this is a step which depreactes the existing non-argument builder. It allows the users to gradually migrate while preserving the necessary checks. Signed-off-by: Dariusz Jędrzejczyk <2554306+chemicL@users.noreply.github.com> Co-authored-by: Dariusz Jędrzejczyk <2554306+chemicL@users.noreply.github.com>
This commit is contained in:
parent
22a0efa577
commit
5d4a1cce42
1 changed files with 51 additions and 4 deletions
|
|
@ -1212,11 +1212,16 @@ public final class McpSchema {
|
||||||
return new Builder(uri, name);
|
return new Builder(uri, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
|
|
||||||
private final String uri;
|
private /* final */ String uri;
|
||||||
|
|
||||||
private final String name;
|
private /* final */ String name;
|
||||||
|
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
|
|
@ -1230,6 +1235,24 @@ public final class McpSchema {
|
||||||
|
|
||||||
private Map<String, Object> meta;
|
private Map<String, Object> meta;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public Builder() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public Builder uri(String uri) {
|
||||||
|
Assert.hasText(uri, "uri must not be empty");
|
||||||
|
this.uri = uri;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public Builder name(String name) {
|
||||||
|
this.name = name;
|
||||||
|
Assert.hasText(name, "name must not be empty");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
private Builder(String uri, String name) {
|
private Builder(String uri, String name) {
|
||||||
Assert.hasText(uri, "uri must not be empty");
|
Assert.hasText(uri, "uri must not be empty");
|
||||||
Assert.hasText(name, "name must not be empty");
|
Assert.hasText(name, "name must not be empty");
|
||||||
|
|
@ -1330,11 +1353,16 @@ public final class McpSchema {
|
||||||
return new Builder(uriTemplate, name);
|
return new Builder(uriTemplate, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
|
|
||||||
private final String uriTemplate;
|
private /* final */ String uriTemplate;
|
||||||
|
|
||||||
private final String name;
|
private /* final */ String name;
|
||||||
|
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
|
|
@ -1346,6 +1374,11 @@ public final class McpSchema {
|
||||||
|
|
||||||
private Map<String, Object> meta;
|
private Map<String, Object> meta;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
private Builder() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private Builder(String uriTemplate, String name) {
|
private Builder(String uriTemplate, String name) {
|
||||||
Assert.hasText(uriTemplate, "uriTemplate must not be empty");
|
Assert.hasText(uriTemplate, "uriTemplate must not be empty");
|
||||||
Assert.hasText(name, "name must not be empty");
|
Assert.hasText(name, "name must not be empty");
|
||||||
|
|
@ -1353,6 +1386,20 @@ public final class McpSchema {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public Builder uriTemplate(String uriTemplate) {
|
||||||
|
Assert.hasText(uriTemplate, "uriTemplate must not be empty");
|
||||||
|
this.uriTemplate = uriTemplate;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public Builder name(String name) {
|
||||||
|
Assert.hasText(name, "name must not be empty");
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Builder title(String title) {
|
public Builder title(String title) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
return this;
|
return this;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue