Interface UriTemplateValue

All Known Implementing Classes:
UriTemplateValue.Scalar, UriTemplateValue.Sequence

public sealed interface UriTemplateValue permits UriTemplateValue.Scalar, UriTemplateValue.Sequence
Value recovered from an RFC 6570 URI template.

Associative values are intentionally unsupported until MCP defines variable schemas that can distinguish them from sequences.

  • Method Details

    • scalarValue

      default String scalarValue()
      Gets the scalar text represented by this value.
      Returns:
      the scalar value or the sole element of a sequence
      Throws:
      IllegalStateException - if the sequence contains more than one element
      UnsupportedOperationException - if the value type is unsupported
    • asScalar

      default UriTemplateValue.Scalar asScalar()
      Converts this value to a scalar representation.
      Returns:
      this value when it is scalar; otherwise, a scalar containing its value
    • asSequence

      default UriTemplateValue.Sequence asSequence()
      Provides the value as a sequence.
      Returns:
      this value if it is already a sequence; otherwise, a single-element sequence containing the scalar value