Interface Extensible<T extends Extensible<T>>

All Known Subinterfaces:
APIResponse, APIResponses, Callback, Components, Contact, Encoding, Example, ExternalDocumentation, Header, Info, License, Link, MediaType, OAuthFlow, OAuthFlows, OpenAPI, Operation, Parameter, PathItem, Paths, RequestBody, Schema, SecurityScheme, Server, ServerVariable, Tag, XML

public interface Extensible<T extends Extensible<T>>
The base interface for OpenAPI model objects that can contain extensions. Extensions contain data not required by the specification and may or may not be supported by the tools you use.

The extension's property names are always prefixed by "x-" unless otherwise specified by sub-interfaces or Extensible methods overridden therein. Sub-interfaces may also include additional detail regarding the handling of extension properties and how they relate to other well-known properties of the interface. For example, Schema defines such handling and relaxes the requirement that extension properties are prefixed by "x-".

  • Method Summary

    Modifier and Type
    Method
    Description
    addExtension(String name, Object value)
    Adds the given extension property to this Extensible, with the given name as its key.
    default T
    extensions(Map<String,Object> extensions)
    Sets this Extensible's extension properties to the given map of extensions.
    default Object
    Returns the object with the given name from this Extensible's extensions.
    Returns the map of all extension properties from an Extensible instance.
    default boolean
    Checks whether an extension with the given name is present in this Extensible.
    void
    Removes an extension with the given property name from this Extensible.
    void
    Sets this Extensible's extension properties to the given map of extensions.
  • Method Details

    • getExtensions

      Map<String,Object> getExtensions()
      Returns the map of all extension properties from an Extensible instance.
      Returns:
      a map containing keys which start with "x-" and values which provide additional information
    • extensions

      default T extensions(Map<String,Object> extensions)
      Sets this Extensible's extension properties to the given map of extensions.
      Parameters:
      extensions - map containing keys which start with "x-" and values which provide additional information
      Returns:
      the current instance
    • addExtension

      T addExtension(String name, Object value)
      Adds the given extension property to this Extensible, with the given name as its key.
      Parameters:
      name - the key used to access the extension object. Always prefixed by "x-".
      value - data not required by the specification. null values will be rejected (implementation will throw an exception) or ignored.
      Returns:
      the current instance
    • removeExtension

      void removeExtension(String name)
      Removes an extension with the given property name from this Extensible.
      Parameters:
      name - the key used to access the extension object. Always prefixed by "x-".
    • setExtensions

      void setExtensions(Map<String,Object> extensions)
      Sets this Extensible's extension properties to the given map of extensions.
      Parameters:
      extensions - map containing keys which start with "x-" and values which provide additional information
    • hasExtension

      default boolean hasExtension(String name)
      Checks whether an extension with the given name is present in this Extensible.
      Parameters:
      name - the key used to access the extension object. Always prefixed by "x-".
      Returns:
      true if an extension with the given name is present, otherwise false
      Since:
      4.1
    • getExtension

      default Object getExtension(String name)
      Returns the object with the given name from this Extensible's extensions.
      Parameters:
      name - the key used to access the extension object. Always prefixed by "x-".
      Returns:
      the corresponding extension object, or null if no extension with the given name is present
      Since:
      4.1