Class Callback

java.lang.Object
org.apache.juneau.bean.openapi3.OpenApiElement
org.apache.juneau.bean.openapi3.Callback

public class Callback extends OpenApiElement
A map of possible out-of-band callbacks related to the parent operation.

The Callback Object is a map of possible out-of-band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.

OpenAPI Specification:

The Callback Object is composed of the following fields:

  • callbacks (map of PathItem) - A map of possible out-of-band callbacks related to the parent operation
Example:

// Construct using SwaggerBuilder. Callback x = callback() .setCallbacks(map("myCallback", pathItem().setPost(operation().setSummary("Callback")))); // Serialize using JsonSerializer. String json = Json.from(x); // Or just use toString() which does the same as above. json = x.toString();

// Output { "callbacks": { "myCallback": { "post": { "summary": "Callback" } } } }

See Also:
  • Constructor Details

    • Callback

      public Callback()
      Default constructor.
    • Callback

      public Callback(Callback copyFrom)
      Copy constructor.
      Parameters:
      copyFrom - The object to copy.
  • Method Details

    • getCallbacks

      Returns the callbacks map.
      Returns:
      The callbacks map.
    • setCallbacks

      Sets the callbacks map.
      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • addCallback

      public Callback addCallback(String expression, PathItem pathItem)
      Adds a callback.
      Parameters:
      expression - The callback expression. Must not be null.
      pathItem - The path item for the callback. Must not be null.
      Returns:
      This object.
    • copy

      public Callback copy()
      Creates a copy of this object.
      Returns:
      A copy of this object.
    • get

      public <T> T get(String property, Class<T> type)
      Description copied from class: OpenApiElement
      Generic property getter.

      Can be used to retrieve non-standard Swagger fields such as "$ref".

      Overrides:
      get in class OpenApiElement
      Type Parameters:
      T - The datatype to cast the value to.
      Parameters:
      property - The property name to retrieve.
      type - The datatype to cast the value to.
      Returns:
      The property value, or null if the property does not exist or is not set.
    • set

      public Callback set(String property, Object value)
      Description copied from class: OpenApiElement
      Generic property setter.

      Can be used to set non-standard Swagger fields such as "$ref".

      Overrides:
      set in class OpenApiElement
      Parameters:
      property - The property name to set. Must not be null.
      value - The new value for the property.
      Returns:
      This object
    • keySet

      public Set<String> keySet()
      Description copied from class: OpenApiElement
      Returns all the keys on this element.
      Overrides:
      keySet in class OpenApiElement
      Returns:
      All the keys on this element.
      Never null.
    • strict

      public Callback strict()
      Description copied from class: OpenApiElement
      Sets strict mode on this bean.
      Overrides:
      strict in class OpenApiElement
      Returns:
      This object
    • strict

      public Callback strict(Object value)
      Description copied from class: OpenApiElement
      Sets strict mode on this bean.
      Overrides:
      strict in class OpenApiElement
      Parameters:
      value - The new value for this property.
      Non-boolean values will be converted to boolean using Boolean.valueOf(value.toString()).
      Can be null (interpreted as false).
      Returns:
      This object