Class Parameter

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

public class Parameter extends OpenApiElement
Describes a single operation parameter.

The Parameter Object describes a single parameter used in an API operation. Parameters can be passed in various locations including the path, query string, headers, or cookies. Each parameter has a name, location, and schema that defines its type and constraints.

OpenAPI Specification:

The Parameter Object is composed of the following fields:

  • name (string, REQUIRED) - The name of the parameter
  • in (string, REQUIRED) - The location of the parameter. Possible values: "query", "header", "path", or "cookie"
  • description (string) - A brief description of the parameter (CommonMark syntax may be used)
  • required (boolean) - Determines whether this parameter is mandatory (must be true if in is "path")
  • deprecated (boolean) - Specifies that a parameter is deprecated
  • allowEmptyValue (boolean) - Sets the ability to pass empty-valued parameters (valid only for "query" parameters)
  • style (string) - Describes how the parameter value will be serialized
  • explode (boolean) - When true, parameter values of type array or object generate separate parameters for each value
  • allowReserved (boolean) - Determines whether the parameter value should allow reserved characters
  • schema (SchemaInfo) - The schema defining the type used for the parameter
  • example (any) - Example of the parameter's potential value
  • examples (map of Example) - Examples of the parameter's potential value
Example:

// Create a query parameter Parameter param = new Parameter() .setName("status") .setIn("query") .setDescription("Status values to filter by") .setRequired(false) .setSchema( new SchemaInfo() .setType("array") .setItems( new Items().setType("string") ) ) .setStyle("form") .setExplode(true);

See Also:
  • Constructor Details

    • Parameter

      public Parameter()
      Default constructor.
    • Parameter

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

    • copy

      public Parameter copy()
      Makes a copy of this object.
      Returns:
      A new copy of this object.
    • getName

      public String getName()
      Returns the parameter name.
      Returns:
      The parameter name.
    • setName

      public Parameter setName(String value)
      Sets the parameter name.
      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • getIn

      public String getIn()
      Returns the parameter location.
      Returns:
      The parameter location.
    • setIn

      public Parameter setIn(String value)
      Sets the parameter location.
      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • getDescription

      Returns the description.
      Returns:
      The description.
    • setDescription

      Sets the description.
      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • getStyle

      public String getStyle()
      Returns the style.
      Returns:
      The style.
    • setStyle

      public Parameter setStyle(String value)
      Sets the style.
      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • getRequired

      public Boolean getRequired()
      Returns the required flag.
      Returns:
      The required flag.
    • setRequired

      public Parameter setRequired(Boolean value)
      Sets the required flag.
      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • getDeprecated

      Returns the deprecated flag.
      Returns:
      The deprecated flag.
    • setDeprecated

      Sets the deprecated flag.
      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • getAllowEmptyValue

      Returns the allow empty value flag.
      Returns:
      The allow empty value flag.
    • setAllowEmptyValue

      Sets the allow empty value flag.
      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • getExplode

      public Boolean getExplode()
      Returns the explode flag.
      Returns:
      The explode flag.
    • setExplode

      public Parameter setExplode(Boolean value)
      Sets the explode flag.
      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • getAllowReserved

      Returns the allow reserved flag.
      Returns:
      The allow reserved flag.
    • setAllowReserved

      Sets the allow reserved flag.
      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • getSchema

      Returns the schema.
      Returns:
      The schema.
    • setSchema

      public Parameter setSchema(SchemaInfo value)
      Sets the schema.
      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • getExample

      public Object getExample()
      Returns the example.
      Returns:
      The example.
    • setExample

      public Parameter setExample(Object value)
      Sets the example.
      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • getExamples

      Returns the examples map.
      Returns:
      The examples map.
    • setExamples

      Sets the examples map.
      Parameters:
      value - The new value for this property.
      Returns:
      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 Parameter 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 Parameter strict()
      Description copied from class: OpenApiElement
      Sets strict mode on this bean.
      Overrides:
      strict in class OpenApiElement
      Returns:
      This object
    • strict

      public Parameter 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