Package io.meeds.mcp.server.model
Record Class PrincipalRef
java.lang.Object
java.lang.Record
io.meeds.mcp.server.model.PrincipalRef
- Record Components:
kind- whether the account is a person's or an agent'susername- the account's login, never blankagentNameId- the agent the account belongs to, set forPrincipalKind.AGENTonly
The platform account that executes a tool call: a person's, or an agent's
own account. An agent account also names the agent it is the account of.
-
Constructor Summary
ConstructorsConstructorDescriptionPrincipalRef(PrincipalKind kind, String username, String agentNameId) Checks the reference is complete and consistent: a kind, a login, and an agent name id exactly when the account is an agent's. -
Method Summary
Modifier and TypeMethodDescriptionstatic PrincipalRefReturns the value of theagentNameIdrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.kind()Returns the value of thekindrecord component.final StringtoString()Returns a string representation of this record class.static PrincipalRefusername()Returns the value of theusernamerecord component.
-
Constructor Details
-
PrincipalRef
Checks the reference is complete and consistent: a kind, a login, and an agent name id exactly when the account is an agent's.- Parameters:
kind- whether the account is a person's or an agent'susername- the account's loginagentNameId- the agent the account belongs to, for an agent only- Throws:
IllegalArgumentException- when a part is missing or does not fit the kind
-
-
Method Details
-
user
- Parameters:
username- a person's login- Returns:
- the reference of that person's account
-
agent
- Parameters:
username- an agent account's loginagentNameId- the agent it is the account of- Returns:
- the reference of that agent account
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
kind
Returns the value of thekindrecord component.- Returns:
- the value of the
kindrecord component
-
username
Returns the value of theusernamerecord component.- Returns:
- the value of the
usernamerecord component
-
agentNameId
Returns the value of theagentNameIdrecord component.- Returns:
- the value of the
agentNameIdrecord component
-