Record Class ChenilePolymorphVariant
java.lang.Object
java.lang.Record
org.chenile.mcp.model.ChenilePolymorphVariant
- Record Components:
nameSuffix- - name suffix for the variant. This will be appended to the tool name.description- - description of the variant1. This must be sufficient to invoke the toolparameterTypes- - types of each of the parameter. If a parameter does not have a type it must have schemaparameterSchemas- - in case a parameter is not of concrete type, the schema (useful for map parameters)- this is an alternative to parameter typeparameterDescriptions- - detailed description of each parameter if available.fixedParameterValues- - This is the only allowed value for the parameter for this variant. See the example given
public record ChenilePolymorphVariant(String nameSuffix, String description, Map<String, tools.jackson.core.type.TypeReference<?>> parameterTypes, Map<String,String> parameterSchemas, Map<String,String> parameterDescriptions, Map<String,Object> fixedParameterValues)
extends Record
Describes each polymorph variant for a given operation in a given service.
Let us say we have a service "foo" and an operation bar(String id, String type,Object payload)
The type parameter above can take values "abc" and "def"
If type == "abc" then the payload must be of type AbcPayload else it must be DefPayload
The PolymorphProvider must return two PolymorphVariants - let us call them "variant1" and "variant2"
"variant1" will have fixed value for type as "abc" and "variant2" will have fixed value for type as "def"
variant1 payload will have parameterType as "AbcPayload". variant2 payload will have parameterType as "DefPayload"
Alternately, it is possible that we can return a payload schema for variant1 instead of payload type.
Both schema and type are not allowed for the same parameter. This class guards against that.
Let us say we have a service "foo" and an operation bar(String id, String type,Object payload)
The type parameter above can take values "abc" and "def"
If type == "abc" then the payload must be of type AbcPayload else it must be DefPayload
The PolymorphProvider must return two PolymorphVariants - let us call them "variant1" and "variant2"
"variant1" will have fixed value for type as "abc" and "variant2" will have fixed value for type as "def"
variant1 payload will have parameterType as "AbcPayload". variant2 payload will have parameterType as "DefPayload"
Alternately, it is possible that we can return a payload schema for variant1 instead of payload type.
Both schema and type are not allowed for the same parameter. This class guards against that.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StringThe field for thedescriptionrecord component.The field for thefixedParameterValuesrecord component.private final StringThe field for thenameSuffixrecord component.The field for theparameterDescriptionsrecord component.The field for theparameterSchemasrecord component.The field for theparameterTypesrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionChenilePolymorphVariant(String nameSuffix, String description, Map<String, tools.jackson.core.type.TypeReference<?>> parameterTypes, Map<String, String> parameterSchemas, Map<String, String> parameterDescriptions, Map<String, Object> fixedParameterValues) Creates an instance of aChenilePolymorphVariantrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedescriptionrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of thefixedParameterValuesrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of thenameSuffixrecord component.Returns the value of theparameterDescriptionsrecord component.Returns the value of theparameterSchemasrecord component.Returns the value of theparameterTypesrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
nameSuffix
The field for thenameSuffixrecord component. -
description
The field for thedescriptionrecord component. -
parameterTypes
The field for theparameterTypesrecord component. -
parameterSchemas
The field for theparameterSchemasrecord component. -
parameterDescriptions
The field for theparameterDescriptionsrecord component. -
fixedParameterValues
The field for thefixedParameterValuesrecord component.
-
-
Constructor Details
-
ChenilePolymorphVariant
public ChenilePolymorphVariant(String nameSuffix, String description, Map<String, tools.jackson.core.type.TypeReference<?>> parameterTypes, Map<String, String> parameterSchemas, Map<String, String> parameterDescriptions, Map<String, Object> fixedParameterValues) Creates an instance of aChenilePolymorphVariantrecord class.- Parameters:
nameSuffix- the value for thenameSuffixrecord componentdescription- the value for thedescriptionrecord componentparameterTypes- the value for theparameterTypesrecord componentparameterSchemas- the value for theparameterSchemasrecord componentparameterDescriptions- the value for theparameterDescriptionsrecord componentfixedParameterValues- the value for thefixedParameterValuesrecord component
-
-
Method Details
-
toString
-
hashCode
-
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). -
nameSuffix
Returns the value of thenameSuffixrecord component.- Returns:
- the value of the
nameSuffixrecord component
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
parameterTypes
Returns the value of theparameterTypesrecord component.- Returns:
- the value of the
parameterTypesrecord component
-
parameterSchemas
Returns the value of theparameterSchemasrecord component.- Returns:
- the value of the
parameterSchemasrecord component
-
parameterDescriptions
Returns the value of theparameterDescriptionsrecord component.- Returns:
- the value of the
parameterDescriptionsrecord component
-
fixedParameterValues
Returns the value of thefixedParameterValuesrecord component.- Returns:
- the value of the
fixedParameterValuesrecord component
-
CHENILE