Record Class McpConfigurationLoader
java.lang.Object
java.lang.Record
com.github.thought2code.mcp.annotated.configuration.McpConfigurationLoader
This record represents a YAML configuration loader for MCP (Model Context Protocol) server
configuration.
It loads the server configuration from a specified YAML file. If no file name is provided, the default file name "mcp-server.yml" will be used.
- Author:
- codeboyzhou
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a YAMLConfigurationLoader with the default configuration file name.McpConfigurationLoader(String configFileName) Creates an instance of aMcpConfigurationLoaderrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theconfigFileNamerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Loads the MCP server configuration from the specified YAML file.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
McpConfigurationLoader
public McpConfigurationLoader()Constructs a YAMLConfigurationLoader with the default configuration file name. -
McpConfigurationLoader
Creates an instance of aMcpConfigurationLoaderrecord class.- Parameters:
configFileName- the value for theconfigFileNamerecord component
-
-
Method Details
-
loadConfig
Loads the MCP server configuration from the specified YAML file.- Returns:
- the loaded MCP server configuration
- Throws:
McpServerConfigurationException- if the configuration file cannot be loaded
-
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). -
configFileName
Returns the value of theconfigFileNamerecord component.- Returns:
- the value of the
configFileNamerecord component
-