Package io.openliberty.mcp.meta
Record Class MetaKey
java.lang.Object
java.lang.Record
io.openliberty.mcp.meta.MetaKey
- Record Components:
prefix- the prefixname- the name
A key for additional metadata defined in the
_meta part of the message.
_meta keys have two segments: an optional prefix, and a name.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.static MetaKeyCreate a new key from the specified string value, i.e.final inthashCode()Returns a hash code value for this object.static booleanisValidName(String value) static booleanisValidPrefix(String value) name()Returns the value of thenamerecord component.static MetaKeyCreate a new key with the specified name but without a prefix.static MetaKeyCreate a new key with the specified name and the prefix is built from the supplied labels.prefix()Returns the value of theprefixrecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
from
Create a new key from the specified string value, i.e. fromfoo.bar/myKey.- Parameters:
value- the value to create the key, which must include a name and can include a prefix- Returns:
- the key
-
of
Create a new key with the specified name but without a prefix.- Parameters:
name- the name of the new key- Returns:
- the key
-
of
Create a new key with the specified name and the prefix is built from the supplied labels.Note that
modelcontextprotocolandmcplabels are reserved for MCP spec.- Parameters:
name- the nameprefixLabels- the prefix labels, which will be joined with period characters to form the prefix- Returns:
- the key
-
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. -
isValidName
-
isValidPrefix
-
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). -
prefix
Returns the value of theprefixrecord component.- Returns:
- the value of the
prefixrecord component
-
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-