Class HeaderInfo

java.lang.Object
org.apache.juneau.dto.swagger.SwaggerElement
org.apache.juneau.dto.swagger.HeaderInfo

@Bean(properties="description,type,format,items,collectionFormat,default,maximum,exclusiveMaximum,minimum,exclusiveMinimum,maxLength,minLength,pattern,maxItems,minItems,uniqueItems,enum,multipleOf,$ref,example,*") public class HeaderInfo extends SwaggerElement
Describes a single HTTP header.
Example:

// Construct using SwaggerBuilder. HeaderInfo headerInfo = headerInfo("integer").description("The number of allowed requests in the current period"); // Serialize using JsonSerializer. String json = JsonSerializer.DEFAULT.toString(headerInfo); // Or just use toString() which does the same as above. json = headerInfo.toString();

// Output { "description": "The number of allowed requests in the current period", "type": "integer" }

See Also:
  • Constructor Details

    • HeaderInfo

      public HeaderInfo()
      Default constructor.
    • HeaderInfo

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

    • copy

      public HeaderInfo copy()
      Make a deep copy of this object.
      Returns:
      A deep copy of this object.
    • strict

      protected HeaderInfo strict()
      Description copied from class: SwaggerElement
      Sets strict mode on this bean.
      Overrides:
      strict in class SwaggerElement
      Returns:
      This object.
    • getCollectionFormat

      Bean property getter: collectionFormat.

      Determines the format of the array if type array is used.

      Returns:
      The property value, or null if it is not set.
    • setCollectionFormat

      Bean property setter: collectionFormat.

      Determines the format of the array if type array is used.

      Parameters:
      value - The new value for this property.
      Valid values:
      • "csv" (default) - comma separated values foo,bar.
      • "ssv" - space separated values foo bar.
      • "tsv" - tab separated values foo\tbar.
      • "pipes" - pipe separated values foo|bar.

      Can be null to unset the property.
      Returns:
      This object.
    • getDefault

      public Object getDefault()
      Bean property getter: default.

      Declares the value of the header that the server will use if none is provided.

      Notes:
      • "default" has no meaning for required items.
      • Unlike JSON Schema this value MUST conform to the defined type for the header.
      Returns:
      The property value, or null if it is not set.
    • setDefault

      public HeaderInfo setDefault(Object value)
      Bean property setter: default.

      Declares the value of the header that the server will use if none is provided.

      Notes:
      • "default" has no meaning for required items.
      • Unlike JSON Schema this value MUST conform to the defined type for the header.
      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object.
    • getDescription

      Bean property getter: description.

      A short description of the header.

      Returns:
      The property value, or null if it is not set.
    • setDescription

      Bean property setter: description.

      A short description of the header.

      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object.
    • getEnum

      public Set<Object> getEnum()
      Bean property getter: enum.
      Returns:
      The property value, or null if it is not set.
    • setEnum

      Bean property setter: enum.
      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object.
    • setEnum

      public HeaderInfo setEnum(Object... value)
      Bean property setter: enum.
      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • addEnum

      public HeaderInfo addEnum(Object... value)
      Bean property fluent setter: enum.
      Parameters:
      value - The new value for this property.
      Strings can be JSON arrays.
      Returns:
      This object.
    • getExample

      public Object getExample()
      Bean property getter: example.
      Returns:
      The property value, or null if it is not set.
    • setExample

      public HeaderInfo setExample(Object value)
      Bean property setter: example.
      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object.
    • getExclusiveMaximum

      Bean property getter: exclusiveMaximum.
      Returns:
      The property value, or null if it is not set.
    • setExclusiveMaximum

      Bean property setter: exclusiveMaximum.
      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object.
    • getExclusiveMinimum

      Bean property getter: exclusiveMinimum.
      Returns:
      The property value, or null if it is not set.
    • setExclusiveMinimum

      Bean property setter: exclusiveMinimum.
      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object.
    • getFormat

      public String getFormat()
      Bean property getter: format.

      The extending format for the previously mentioned type.

      Returns:
      The property value, or null if it is not set.
    • setFormat

      public HeaderInfo setFormat(String value)
      Bean property setter: format.

      The extending format for the previously mentioned type.

      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object.
    • getItems

      public Items getItems()
      Bean property getter: items.

      Describes the type of items in the array.

      Returns:
      The property value, or null if it is not set.
    • setItems

      public HeaderInfo setItems(Items value)
      Bean property setter: items.

      Describes the type of items in the array.

      Parameters:
      value - The new value for this property.
      Property value is required if type is "array".
      Can be null to unset the property.
      Returns:
      This object.
    • getMaximum

      public Number getMaximum()
      Bean property getter: maximum.
      Returns:
      The property value, or null if it is not set.
    • setMaximum

      public HeaderInfo setMaximum(Number value)
      Bean property setter: maximum.
      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object.
    • getMaxItems

      public Integer getMaxItems()
      Bean property getter: maxItems.
      Returns:
      The property value, or null if it is not set.
    • setMaxItems

      public HeaderInfo setMaxItems(Integer value)
      Bean property setter: maxItems.
      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object.
    • getMaxLength

      Bean property getter: maxLength.
      Returns:
      The property value, or null if it is not set.
    • setMaxLength

      Bean property setter: maxLength.
      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object.
    • getMinimum

      public Number getMinimum()
      Bean property getter: minimum.
      Returns:
      The property value, or null if it is not set.
    • setMinimum

      public HeaderInfo setMinimum(Number value)
      Bean property setter: minimum.
      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object.
    • getMinItems

      public Integer getMinItems()
      Bean property getter: minItems.
      Returns:
      The property value, or null if it is not set.
    • setMinItems

      public HeaderInfo setMinItems(Integer value)
      Bean property setter: minItems.
      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object.
    • getMinLength

      Bean property getter: minLength.
      Returns:
      The property value, or null if it is not set.
    • setMinLength

      Bean property setter: minLength.
      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object.
    • getMultipleOf

      Bean property getter: multipleOf.
      Returns:
      The property value, or null if it is not set.
    • setMultipleOf

      Bean property setter: multipleOf.
      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object.
    • getPattern

      public String getPattern()
      Bean property getter: pattern.
      Returns:
      The property value, or null if it is not set.
    • setPattern

      public HeaderInfo setPattern(String value)
      Bean property setter: pattern.
      Parameters:
      value - The new value for this property.
      This string SHOULD be a valid regular expression.
      Can be null to unset the property.
      Returns:
      This object.
    • getRef

      @Beanp("$ref") public String getRef()
      Bean property getter: $ref.
      Returns:
      The property value, or null if it is not set.
    • setRef

      @Beanp("$ref") public HeaderInfo setRef(String value)
      Bean property setter: $ref.
      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object.
    • getType

      public String getType()
      Bean property getter: type.

      The type of the object.

      Returns:
      The property value, or null if it is not set.
    • setType

      public HeaderInfo setType(String value)
      Bean property setter: type.

      The type of the object.

      Parameters:
      value - The new value for this property.
      Property value is required.
      Valid values:
      • "string"
      • "number"
      • "integer"
      • "boolean"
      • "array"
      Returns:
      This object.
    • getUniqueItems

      Bean property getter: uniqueItems.
      Returns:
      The property value, or null if it is not set.
    • setUniqueItems

      Bean property setter: uniqueItems.
      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object.
    • get

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

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

      Overrides:
      get in class SwaggerElement
      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 HeaderInfo set(String property, Object value)
      Description copied from class: SwaggerElement
      Generic property setter.

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

      Overrides:
      set in class SwaggerElement
      Parameters:
      property - The property name to set.
      value - The new value for the property.
      Returns:
      This object.
    • keySet

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

      public HeaderInfo resolveRefs(Swagger swagger, Deque<String> refStack, int maxDepth)
      Resolves any "$ref" attributes in this element.
      Parameters:
      swagger - The swagger document containing the definitions.
      refStack - Keeps track of previously-visited references so that we don't cause recursive loops.
      maxDepth - The maximum depth to resolve references.
      After that level is reached, $ref references will be left alone.
      Useful if you have very complex models and you don't want your swagger page to be overly-complex.
      Returns:
      This object with references resolved.
      May or may not be the same object.