feat: implement identifier-based equals/hashCode for PromptReference (#514)
Ensure PromptReference equality is based solely on identifier and type fields, ignoring other fields like title Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
This commit is contained in:
parent
713ee1add0
commit
888e555026
1 changed files with 103 additions and 0 deletions
|
|
@ -2351,6 +2351,22 @@ public final class McpSchema {
|
|||
public String identifier() {
|
||||
return name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null || getClass() != obj.getClass())
|
||||
return false;
|
||||
PromptReference that = (PromptReference) obj;
|
||||
return java.util.Objects.equals(identifier(), that.identifier())
|
||||
&& java.util.Objects.equals(type(), that.type());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return java.util.Objects.hash(identifier(), type());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue