Record Class ChenilePolymorphVariant
java.lang.Object
java.lang.Record
org.chenile.core.polymorph.ChenilePolymorphVariant
- Record Components:
name- the variant's complete, canonical name, used unchanged by MCP, OpenAPI and the registry. SeeChenilePolymorphProvider.variantName(OperationDefinition, String).description- a description sufficient to invoke the variant. Defaults to the operation's description when blank.parameterTypes- the type of each parameter that differs from the operation's own declaration.parameterSchemas- a JSON schema for a parameter that has no concrete type (an alternative to a type; both are not allowed for the same parameter).parameterDescriptions- a description of each parameter, where available.fixedParameterValues- the only allowed value of a parameter for this variant. These values select the variant of a request: a path variable or header with that value.bodyDiscriminator- for subclass polymorphism, the top-level body field and value that select this variant. Null otherwise.- the authorities needed to invoke this variant. Empty means the operation's own authorities apply.
public record ChenilePolymorphVariant(String name, String description, Map<String,Type> parameterTypes, Map<String,String> parameterSchemas, Map<String,String> parameterDescriptions, Map<String,Object> fixedParameterValues, ChenilePolymorphVariant.BodyDiscriminator bodyDiscriminator, List<String> authorities)
extends Record
One variant of a polymorphic operation. Let us say a service "foo" has an operation
bar(String id, String type, Object payload) where type "abc" needs an AbcPayload and type "def" a
DefPayload. The provider returns two variants: the first fixes type to "abc" and gives the payload the type
AbcPayload, the second fixes type to "def" with DefPayload.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordThe top-level body field and the value of it that select a variant. -
Field Summary
FieldsModifier and TypeFieldDescriptionThe field for theauthoritiesrecord component.private final ChenilePolymorphVariant.BodyDiscriminatorThe field for thebodyDiscriminatorrecord component.private final StringThe field for thedescriptionrecord component.The field for thefixedParameterValuesrecord component.private final StringThe field for thenamerecord component.The field for theparameterDescriptionsrecord component.The field for theparameterSchemasrecord component.The field for theparameterTypesrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionChenilePolymorphVariant(String name, String description, Map<String, Type> parameterTypes, Map<String, String> parameterSchemas, Map<String, String> parameterDescriptions, Map<String, Object> fixedParameterValues) A variant selected by fixed parameter values only, with no body discriminator and no authorities of its own.ChenilePolymorphVariant(String name, String description, Map<String, Type> parameterTypes, Map<String, String> parameterSchemas, Map<String, String> parameterDescriptions, Map<String, Object> fixedParameterValues, ChenilePolymorphVariant.BodyDiscriminator bodyDiscriminator, List<String> authorities) Creates an instance of aChenilePolymorphVariantrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theauthoritiesrecord component.Returns the value of thebodyDiscriminatorrecord component.Returns 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.name()Returns the value of thenamerecord 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.withDescription(String newDescription) A copy of this variant with another description.
-
Field Details
-
name
-
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. -
bodyDiscriminator
The field for thebodyDiscriminatorrecord component. -
authorities
The field for theauthoritiesrecord component.
-
-
Constructor Details
-
ChenilePolymorphVariant
public ChenilePolymorphVariant(String name, String description, Map<String, Type> parameterTypes, Map<String, String> parameterSchemas, Map<String, String> parameterDescriptions, Map<String, Object> fixedParameterValues, ChenilePolymorphVariant.BodyDiscriminator bodyDiscriminator, List<String> authorities) Creates an instance of aChenilePolymorphVariantrecord class.- Parameters:
name- the value for thenamerecord 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 componentbodyDiscriminator- the value for thebodyDiscriminatorrecord componentauthorities- the value for theauthoritiesrecord component
-
ChenilePolymorphVariant
public ChenilePolymorphVariant(String name, String description, Map<String, Type> parameterTypes, Map<String, String> parameterSchemas, Map<String, String> parameterDescriptions, Map<String, Object> fixedParameterValues) A variant selected by fixed parameter values only, with no body discriminator and no authorities of its own.
-
-
Method Details
-
withDescription
A copy of this variant with another description. -
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). -
name
-
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
-
bodyDiscriminator
Returns the value of thebodyDiscriminatorrecord component.- Returns:
- the value of the
bodyDiscriminatorrecord component
-
authorities
Returns the value of theauthoritiesrecord component.- Returns:
- the value of the
authoritiesrecord component
-
CHENILE