You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2018/01/18 19:00:59 UTC
[03/10] juneau git commit: JUNEAU-78
http://git-wip-us.apache.org/repos/asf/juneau/blob/8df34f56/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/SchemaInfo.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/SchemaInfo.java b/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/SchemaInfo.java
index fe27eba..34bef24 100644
--- a/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/SchemaInfo.java
+++ b/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/SchemaInfo.java
@@ -12,6 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.dto.swagger;
+import static org.apache.juneau.internal.BeanPropertyUtils.*;
import java.util.*;
import org.apache.juneau.annotation.*;
@@ -28,63 +29,80 @@ import org.apache.juneau.annotation.*;
* Further information about the properties can be found in JSON Schema Core and JSON Schema Validation.
* Unless stated otherwise, the property definitions follow the JSON Schema specification as referenced here.
*
+ * <h5 class='section'>Example:</h5>
+ * <p class='bcode'>
+ * <jc>// Construct using SwaggerBuilder.</jc>
+ * SchemaInfo x = <jsm>schemaInfo</jsm>()
+ * .type("string")
+ * .title("foo")
+ *
+ * <jc>// Serialize using JsonSerializer.</jc>
+ * String json = JsonSerializer.<jsf>DEFAULT</jsf>.toString(x);
+ *
+ * <jc>// Or just use toString() which does the same as above.</jc>
+ * String json = x.toString();
+ * </p>
+ * <p class='bcode'>
+ * <jc>// Output</jc>
+ * {
+ * <js>"type"</js>: <js>"string"</js>,
+ * <js>"title"</js>: <js>"foo"</js>
+ * }
+ * </p>
+ *
* <h6 class='topic'>Additional Information</h6>
* <ul class='doctree'>
- * <li class='link'>
- * <a class='doclink' href='../../../../../overview-summary.html#DTOs'>Juneau Data Transfer Objects
- * (org.apache.juneau.dto)</a>
- * <ul>
- * <li class='sublink'>
- * <a class='doclink' href='../../../../../overview-summary.html#DTOs.Swagger'>Swagger</a>
- * </ul>
- * </li>
- * <li class='jp'>
- * <a class='doclink' href='package-summary.html#TOC'>org.apache.juneau.dto.swagger</a>
- * </li>
+ * <li class='link'><a class='doclink' href='../../../../../overview-summary.html#juneau-dto.Swagger'>Overview > juneau-dto > Swagger</a>
* </ul>
*/
-@Bean(properties="format,title,description,default,multipleOf,maximum,exclusiveMaximum,minimum,exclusiveMinimum,maxLength,minLength,pattern,maxItems,minItems,uniqueItems,maxProperties,minProperties,required,enum,type,items,allOf,properties,additionalProperties,discriminator,readOnly,xml,externalDocs,example")
-@SuppressWarnings({ "unchecked" })
+@Bean(properties="format,title,description,default,multipleOf,maximum,exclusiveMaximum,minimum,exclusiveMinimum,maxLength,minLength,pattern,maxItems,minItems,uniqueItems,maxProperties,minProperties,required,enum,type,items,allOf,properties,additionalProperties,discriminator,readOnly,xml,externalDocs,example,*")
public class SchemaInfo extends SwaggerElement {
- private String format;
- private String title;
- private String description;
- private Object _default;
- private Number multipleOf;
- private Number maximum;
- private Boolean exclusiveMaximum;
- private Number minimum;
- private Boolean exclusiveMinimum;
- private Integer maxLength;
- private Integer minLength;
- private String pattern;
- private Integer maxItems;
- private Integer minItems;
- private Boolean uniqueItems;
- private Integer maxProperties;
- private Integer minProperties;
- private Boolean required;
- private List<Object> _enum;
- private String type;
+ private String
+ format,
+ title,
+ description,
+ pattern,
+ type,
+ discriminator;
+ private Number
+ multipleOf,
+ maximum,
+ minimum;
+ private Integer
+ maxLength,
+ minLength,
+ maxItems,
+ minItems,
+ maxProperties,
+ minProperties;
+ private Boolean
+ exclusiveMaximum,
+ exclusiveMinimum,
+ uniqueItems,
+ required,
+ readOnly;
+ private Object
+ _default,
+ example;
private Items items;
- private List<Object> allOf;
- private Map<String,Map<String,Object>> properties;
- private Map<String,Object> additionalProperties;
- private String discriminator;
- private Boolean readOnly;
private Xml xml;
private ExternalDocumentation externalDocs;
- private Object example;
+ private List<Object>
+ _enum,
+ allOf;
+ private Map<String,Map<String,Object>> properties;
+ private Map<String,Object> additionalProperties;
/**
* Bean property getter: <property>format</property>.
*
- * <p>
- * See <a class="doclink" href="http://swagger.io/specification/#dataTypeFormat">Data Type Formats</a> for further
- * details.
+ * <h5 class='section'>Additional Info:</h5>
+ * <ul>
+ * <li><a class="doclink" href="http://swagger.io/specification/#dataTypeFormat">Data Type Formats</a>
+ * </ul>
*
- * @return The value of the <property>format</property> property on this bean, or <jk>null</jk> if it is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public String getFormat() {
return format;
@@ -93,32 +111,38 @@ public class SchemaInfo extends SwaggerElement {
/**
* Bean property setter: <property>format</property>.
*
- * <p>
- * See <a class="doclink" href="http://swagger.io/specification/#dataTypeFormat">Data Type Formats</a> for further
- * details.
+ * <h5 class='section'>Additional Info:</h5>
+ * <ul>
+ * <li><a class="doclink" href="http://swagger.io/specification/#dataTypeFormat">Data Type Formats</a>
+ * </ul>
*
- * @param format The new value for the <property>format</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setFormat(String format) {
- this.format = format;
+ public SchemaInfo setFormat(String value) {
+ format = value;
return this;
}
/**
- * Synonym for {@link #setFormat(String)}.
+ * Same as {@link #setFormat(String)}.
*
- * @param format The new value for the <property>format</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Non-String values will be converted to String using <code>toString()</code>.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo format(String format) {
- return setFormat(format);
+ public SchemaInfo format(Object value) {
+ return setFormat(toStringVal(value));
}
/**
* Bean property getter: <property>title</property>.
*
- * @return The value of the <property>title</property> property on this bean, or <jk>null</jk> if it is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public String getTitle() {
return title;
@@ -127,32 +151,33 @@ public class SchemaInfo extends SwaggerElement {
/**
* Bean property setter: <property>title</property>.
*
- * @param title The new value for the <property>title</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setTitle(String title) {
- this.title = title;
+ public SchemaInfo setTitle(String value) {
+ title = value;
return this;
}
/**
- * Synonym for {@link #setTitle(String)}.
+ * Same as {@link #setTitle(String)}.
*
- * @param title The new value for the <property>title</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Non-String values will be converted to String using <code>toString()</code>.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo title(String title) {
- return setTitle(title);
+ public SchemaInfo title(Object value) {
+ return setTitle(toStringVal(value));
}
/**
* Bean property getter: <property>description</property>.
*
- * <p>
- * <a class="doclink" href="https://help.github.com/articles/github-flavored-markdown">GFM syntax</a> can be used
- * for rich text representation.
- *
- * @return The value of the <property>description</property> property on this bean, or <jk>null</jk> if it is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public String getDescription() {
return description;
@@ -161,26 +186,28 @@ public class SchemaInfo extends SwaggerElement {
/**
* Bean property setter: <property>description</property>.
*
- * <p>
- * <a class="doclink" href="https://help.github.com/articles/github-flavored-markdown">GFM syntax</a> can be used
- * for rich text representation.
- *
- * @param description The new value for the <property>description</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br><a class="doclink" href="https://help.github.com/articles/github-flavored-markdown">GFM syntax</a> can be used for rich text representation.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setDescription(String description) {
- this.description = description;
+ public SchemaInfo setDescription(String value) {
+ description = value;
return this;
}
/**
- * Synonym for {@link #setDescription(String)}.
+ * Same as {@link #setDescription(String)}.
*
- * @param description The new value for the <property>description</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Non-String values will be converted to String using <code>toString()</code>.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo description(String description) {
- return setDescription(description);
+ public SchemaInfo description(Object value) {
+ return setDescription(toStringVal(value));
}
/**
@@ -189,7 +216,7 @@ public class SchemaInfo extends SwaggerElement {
* <p>
* Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object.
*
- * @return The value of the <property>default</property> property on this bean, or <jk>null</jk> if it is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public Object getDefault() {
return _default;
@@ -201,28 +228,30 @@ public class SchemaInfo extends SwaggerElement {
* <p>
* Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object.
*
- * @param _default The new value for the <property>default</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setDefault(Object _default) {
- this._default = _default;
+ public SchemaInfo setDefault(Object value) {
+ _default = value;
return this;
}
/**
- * Synonym for {@link #setDefault(Object)}.
+ * Same as {@link #setDefault(Object)}.
*
- * @param _default The new value for the <property>default</property> property on this bean.
+ * @param value The new value for this property.
* @return This object (for method chaining).
*/
- public SchemaInfo _default(Object _default) {
- return setDefault(_default);
+ public SchemaInfo _default(Object value) {
+ return setDefault(value);
}
/**
* Bean property getter: <property>multipleOf</property>.
*
- * @return The value of the <property>multipleOf</property> property on this bean, or <jk>null</jk> if it is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public Number getMultipleOf() {
return multipleOf;
@@ -231,28 +260,33 @@ public class SchemaInfo extends SwaggerElement {
/**
* Bean property setter: <property>multipleOf</property>.
*
- * @param multipleOf The new value for the <property>multipleOf</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setMultipleOf(Number multipleOf) {
- this.multipleOf = multipleOf;
+ public SchemaInfo setMultipleOf(Number value) {
+ multipleOf = value;
return this;
}
/**
- * Synonym for {@link #setMultipleOf(Number)}.
+ * Same as {@link #setMultipleOf(Number)}.
*
- * @param multipleOf The new value for the <property>multipleOf</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Non-Number values will be converted to Number using <code>toString()</code> then best number match.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo multipleOf(Number multipleOf) {
- return setMultipleOf(multipleOf);
+ public SchemaInfo multipleOf(Object value) {
+ return setMultipleOf(toNumber(value));
}
/**
* Bean property getter: <property>maximum</property>.
*
- * @return The value of the <property>maximum</property> property on this bean, or <jk>null</jk> if it is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public Number getMaximum() {
return maximum;
@@ -261,30 +295,33 @@ public class SchemaInfo extends SwaggerElement {
/**
* Bean property setter: <property>maximum</property>.
*
- * @param maximum The new value for the <property>maximum</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setMaximum(Number maximum) {
- this.maximum = maximum;
+ public SchemaInfo setMaximum(Number value) {
+ maximum = value;
return this;
}
/**
- * Synonym for {@link #setMaximum(Number)}.
+ * Same as {@link #setMaximum(Number)}.
*
- * @param maximum The new value for the <property>maximum</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Non-Number values will be converted to Number using <code>toString()</code> then best number match.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo maximum(Number maximum) {
- return setMaximum(maximum);
+ public SchemaInfo maximum(Object value) {
+ return setMaximum(toNumber(value));
}
/**
* Bean property getter: <property>exclusiveMaximum</property>.
*
- * @return
- * The value of the <property>exclusiveMaximum</property> property on this bean, or <jk>null</jk> if it is
- * not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public Boolean getExclusiveMaximum() {
return exclusiveMaximum;
@@ -293,28 +330,33 @@ public class SchemaInfo extends SwaggerElement {
/**
* Bean property setter: <property>exclusiveMaximum</property>.
*
- * @param exclusiveMaximum The new value for the <property>exclusiveMaximum</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setExclusiveMaximum(Boolean exclusiveMaximum) {
- this.exclusiveMaximum = exclusiveMaximum;
+ public SchemaInfo setExclusiveMaximum(Boolean value) {
+ exclusiveMaximum = value;
return this;
}
/**
- * Synonym for {@link #setExclusiveMaximum(Boolean)}.
+ * Same as {@link #setExclusiveMaximum(Boolean)}.
*
- * @param exclusiveMaximum The new value for the <property>exclusiveMaximum</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Non-boolean values will be converted to boolean using <code>Boolean.<jsm>valueOf</jsm>(value.toString())</code>.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo exclusiveMaximum(Boolean exclusiveMaximum) {
- return setExclusiveMaximum(exclusiveMaximum);
+ public SchemaInfo exclusiveMaximum(Object value) {
+ return setExclusiveMaximum(toBoolean(value));
}
/**
* Bean property getter: <property>minimum</property>.
*
- * @return The value of the <property>minimum</property> property on this bean, or <jk>null</jk> if it is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public Number getMinimum() {
return minimum;
@@ -323,30 +365,33 @@ public class SchemaInfo extends SwaggerElement {
/**
* Bean property setter: <property>minimum</property>.
*
- * @param minimum The new value for the <property>minimum</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setMinimum(Number minimum) {
- this.minimum = minimum;
+ public SchemaInfo setMinimum(Number value) {
+ minimum = value;
return this;
}
/**
- * Synonym for {@link #setMinimum(Number)}.
+ * Same as {@link #setMinimum(Number)}.
*
- * @param minimum The new value for the <property>minimum</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Non-Number values will be converted to Number using <code>toString()</code> then best number match.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo minimum(Number minimum) {
- return setMinimum(minimum);
+ public SchemaInfo minimum(Object value) {
+ return setMinimum(toNumber(value));
}
/**
* Bean property getter: <property>exclusiveMinimum</property>.
*
- * @return
- * The value of the <property>exclusiveMinimum</property> property on this bean, or <jk>null</jk> if it is
- * not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public Boolean getExclusiveMinimum() {
return exclusiveMinimum;
@@ -355,28 +400,33 @@ public class SchemaInfo extends SwaggerElement {
/**
* Bean property setter: <property>exclusiveMinimum</property>.
*
- * @param exclusiveMinimum The new value for the <property>exclusiveMinimum</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setExclusiveMinimum(Boolean exclusiveMinimum) {
- this.exclusiveMinimum = exclusiveMinimum;
+ public SchemaInfo setExclusiveMinimum(Boolean value) {
+ exclusiveMinimum = value;
return this;
}
/**
- * Synonym for {@link #setExclusiveMinimum(Boolean)}.
+ * Same as {@link #setExclusiveMinimum(Boolean)}.
*
- * @param exclusiveMinimum The new value for the <property>exclusiveMinimum</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Non-boolean values will be converted to boolean using <code>Boolean.<jsm>valueOf</jsm>(value.toString())</code>.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo exclusiveMinimum(Boolean exclusiveMinimum) {
- return setExclusiveMinimum(exclusiveMinimum);
+ public SchemaInfo exclusiveMinimum(Object value) {
+ return setExclusiveMinimum(toBoolean(value));
}
/**
* Bean property getter: <property>maxLength</property>.
*
- * @return The value of the <property>maxLength</property> property on this bean, or <jk>null</jk> if it is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public Integer getMaxLength() {
return maxLength;
@@ -385,28 +435,33 @@ public class SchemaInfo extends SwaggerElement {
/**
* Bean property setter: <property>maxLength</property>.
*
- * @param maxLength The new value for the <property>maxLength</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setMaxLength(Integer maxLength) {
- this.maxLength = maxLength;
+ public SchemaInfo setMaxLength(Integer value) {
+ maxLength = value;
return this;
}
/**
- * Synonym for {@link #setMaxLength(Integer)}.
+ * Same as {@link #setMaxLength(Integer)}.
*
- * @param maxLength The new value for the <property>maxLength</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Non-Integer values will be converted to Integer using <code>Integer.<jsm>valueOf</jsm>(value.toString())</code>.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo maxLength(Integer maxLength) {
- return setMaxLength(maxLength);
+ public SchemaInfo maxLength(Object value) {
+ return setMaxLength(toInteger(value));
}
/**
* Bean property getter: <property>minLength</property>.
*
- * @return The value of the <property>minLength</property> property on this bean, or <jk>null</jk> if it is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public Integer getMinLength() {
return minLength;
@@ -415,28 +470,33 @@ public class SchemaInfo extends SwaggerElement {
/**
* Bean property setter: <property>minLength</property>.
*
- * @param minLength The new value for the <property>minLength</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setMinLength(Integer minLength) {
- this.minLength = minLength;
+ public SchemaInfo setMinLength(Integer value) {
+ minLength = value;
return this;
}
/**
- * Synonym for {@link #setMinLength(Integer)}.
+ * Same as {@link #setMinLength(Integer)}.
*
- * @param minLength The new value for the <property>minLength</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Non-Integer values will be converted to Integer using <code>Integer.<jsm>valueOf</jsm>(value.toString())</code>.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo minLength(Integer minLength) {
- return setMinLength(minLength);
+ public SchemaInfo minLength(Object value) {
+ return setMinLength(toInteger(value));
}
/**
* Bean property getter: <property>pattern</property>.
*
- * @return The value of the <property>pattern</property> property on this bean, or <jk>null</jk> if it is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public String getPattern() {
return pattern;
@@ -445,28 +505,33 @@ public class SchemaInfo extends SwaggerElement {
/**
* Bean property setter: <property>pattern</property>.
*
- * @param pattern The new value for the <property>pattern</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setPattern(String pattern) {
- this.pattern = pattern;
+ public SchemaInfo setPattern(String value) {
+ pattern = value;
return this;
}
/**
- * Synonym for {@link #setPattern(String)}.
+ * Same as {@link #setPattern(String)}.
*
- * @param pattern The new value for the <property>pattern</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Non-String values will be converted to String using <code>toString()</code>.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo pattern(String pattern) {
- return setPattern(pattern);
+ public SchemaInfo pattern(Object value) {
+ return setPattern(toStringVal(value));
}
/**
* Bean property getter: <property>maxItems</property>.
*
- * @return The value of the <property>maxItems</property> property on this bean, or <jk>null</jk> if it is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public Integer getMaxItems() {
return maxItems;
@@ -475,28 +540,33 @@ public class SchemaInfo extends SwaggerElement {
/**
* Bean property setter: <property>maxItems</property>.
*
- * @param maxItems The new value for the <property>maxItems</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setMaxItems(Integer maxItems) {
- this.maxItems = maxItems;
+ public SchemaInfo setMaxItems(Integer value) {
+ maxItems = value;
return this;
}
/**
- * Synonym for {@link #setMaxItems(Integer)}.
+ * Same as {@link #setMaxItems(Integer)}.
*
- * @param maxItems The new value for the <property>maxItems</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Non-Integer values will be converted to Integer using <code>Integer.<jsm>valueOf</jsm>(value.toString())</code>.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo maxItems(Integer maxItems) {
- return setMaxItems(maxItems);
+ public SchemaInfo maxItems(Object value) {
+ return setMaxItems(toInteger(value));
}
/**
* Bean property getter: <property>minItems</property>.
*
- * @return The value of the <property>minItems</property> property on this bean, or <jk>null</jk> if it is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public Integer getMinItems() {
return minItems;
@@ -505,29 +575,33 @@ public class SchemaInfo extends SwaggerElement {
/**
* Bean property setter: <property>minItems</property>.
*
- * @param minItems The new value for the <property>minItems</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setMinItems(Integer minItems) {
- this.minItems = minItems;
+ public SchemaInfo setMinItems(Integer value) {
+ minItems = value;
return this;
}
/**
- * Synonym for {@link #setMinItems(Integer)}.
+ * Same as {@link #setMinItems(Integer)}.
*
- * @param minItems The new value for the <property>minItems</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Non-Integer values will be converted to Integer using <code>Integer.<jsm>valueOf</jsm>(value.toString())</code>.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo minItems(Integer minItems) {
- return setMinItems(minItems);
+ public SchemaInfo minItems(Object value) {
+ return setMinItems(toInteger(value));
}
/**
* Bean property getter: <property>uniqueItems</property>.
*
- * @return The value of the <property>uniqueItems</property> property on this bean, or <jk>null</jk> if it is not
- * set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public Boolean getUniqueItems() {
return uniqueItems;
@@ -535,29 +609,33 @@ public class SchemaInfo extends SwaggerElement {
/**
* Bean property setter: <property>uniqueItems</property>.
*
- * @param uniqueItems The new value for the <property>uniqueItems</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setUniqueItems(Boolean uniqueItems) {
- this.uniqueItems = uniqueItems;
+ public SchemaInfo setUniqueItems(Boolean value) {
+ uniqueItems = value;
return this;
}
/**
- * Synonym for {@link #setUniqueItems(Boolean)}.
+ * Same as {@link #setUniqueItems(Boolean)}.
*
- * @param uniqueItems The new value for the <property>uniqueItems</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Non-boolean values will be converted to boolean using <code>Boolean.<jsm>valueOf</jsm>(value.toString())</code>.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo uniqueItems(Boolean uniqueItems) {
- return setUniqueItems(uniqueItems);
+ public SchemaInfo uniqueItems(Object value) {
+ return setUniqueItems(toBoolean(value));
}
/**
* Bean property getter: <property>maxProperties</property>.
*
- * @return The value of the <property>maxProperties</property> property on this bean, or <jk>null</jk> if it is
- * not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public Integer getMaxProperties() {
return maxProperties;
@@ -566,29 +644,33 @@ public class SchemaInfo extends SwaggerElement {
/**
* Bean property setter: <property>maxProperties</property>.
*
- * @param maxProperties The new value for the <property>maxProperties</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setMaxProperties(Integer maxProperties) {
- this.maxProperties = maxProperties;
+ public SchemaInfo setMaxProperties(Integer value) {
+ maxProperties = value;
return this;
}
/**
- * Synonym for {@link #setMaxProperties(Integer)}.
+ * Same as {@link #setMaxProperties(Integer)}.
*
- * @param maxProperties The new value for the <property>maxProperties</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Non-Integer values will be converted to Integer using <code>Integer.<jsm>valueOf</jsm>(value.toString())</code>.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo maxProperties(Integer maxProperties) {
- return setMaxProperties(maxProperties);
+ public SchemaInfo maxProperties(Object value) {
+ return setMaxProperties(toInteger(value));
}
/**
* Bean property getter: <property>minProperties</property>.
*
- * @return The value of the <property>minProperties</property> property on this bean, or <jk>null</jk> if it is
- * not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public Integer getMinProperties() {
return minProperties;
@@ -597,28 +679,33 @@ public class SchemaInfo extends SwaggerElement {
/**
* Bean property setter: <property>minProperties</property>.
*
- * @param minProperties The new value for the <property>minProperties</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setMinProperties(Integer minProperties) {
- this.minProperties = minProperties;
+ public SchemaInfo setMinProperties(Integer value) {
+ minProperties = value;
return this;
}
/**
- * Synonym for {@link #setMinProperties(Integer)}.
+ * Same as {@link #setMinProperties(Integer)}.
*
- * @param minProperties The new value for the <property>minProperties</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Non-Integer values will be converted to Integer using <code>Integer.<jsm>valueOf</jsm>(value.toString())</code>.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo minProperties(Integer minProperties) {
- return setMinProperties(minProperties);
+ public SchemaInfo minProperties(Object value) {
+ return setMinProperties(toInteger(value));
}
/**
* Bean property getter: <property>required</property>.
*
- * @return The value of the <property>required</property> property on this bean, or <jk>null</jk> if it is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public Boolean getRequired() {
return required;
@@ -627,28 +714,33 @@ public class SchemaInfo extends SwaggerElement {
/**
* Bean property setter: <property>required</property>.
*
- * @param required The new value for the <property>required</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setRequired(Boolean required) {
- this.required = required;
+ public SchemaInfo setRequired(Boolean value) {
+ required = value;
return this;
}
/**
- * Synonym for {@link #setRequired(Boolean)}.
+ * Same as {@link #setRequired(Boolean)}.
*
- * @param required The new value for the <property>required</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Non-boolean values will be converted to boolean using <code>Boolean.<jsm>valueOf</jsm>(value.toString())</code>.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo required(Boolean required) {
- return setRequired(required);
+ public SchemaInfo required(Object value) {
+ return setRequired(toBoolean(value));
}
/**
* Bean property getter: <property>enum</property>.
*
- * @return The value of the <property>enum</property> property on this bean, or <jk>null</jk> if it is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public List<Object> getEnum() {
return _enum;
@@ -657,52 +749,66 @@ public class SchemaInfo extends SwaggerElement {
/**
* Bean property setter: <property>enum</property>.
*
- * @param _enum The new value for the <property>enum</property> property on this bean.
+ * <h5 class='section'>Additional Info:</h5>
+ * <ul>
+ * <li><a class="doclink" href="http://json-schema.org/latest/json-schema-validation.html#anchor76">http://json-schema.org/latest/json-schema-validation.html#anchor76</a>
+ * </ul>
+ *
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setEnum(List<Object> _enum) {
- this._enum = _enum;
+ public SchemaInfo setEnum(Collection<Object> value) {
+ _enum = newList(value);
return this;
}
/**
- * Bean property adder: <property>enum</property>.
+ * Adds one or more values to the <property>enum</property> property.
*
- * @param _enum The new values to add to the <property>enum</property> property on this bean.
- * These can either be individual objects or {@link Collection Collections} of objects.
+ * @param value
+ * The values to add to this property.
+ * <br>Ignored if <jk>null</jk>.
* @return This object (for method chaining).
*/
- public SchemaInfo addEnum(Object..._enum) {
- for (Object o : _enum) {
- if (o != null) {
- if (o instanceof Collection)
- addEnum((Collection<Object>)o);
- else {
- if (this._enum == null)
- this._enum = new LinkedList<>();
- this._enum.add(o);
- }
- }
- }
+ public SchemaInfo addEnum(Collection<Object> value) {
+ _enum = addToList(_enum, value);
return this;
}
-
- /**
- * Synonym for {@link #addEnum(Object...)}.
- *
- * @param _enum
- * The new values to add to the <property>enum</property> property on this bean.
- * These can either be individual objects or {@link Collection Collections} of objects.
+
+ /**
+ * Adds one or more values to the <property>enum</property> property.
+ *
+ * @param values
+ * The values to add to this property.
+ * <br>Valid types:
+ * <ul>
+ * <li><code>Object</code>
+ * <li><code>Collection<Object></code>
+ * <li><code>String</code> - JSON array representation of <code>Collection<Object></code>
+ * <h6 class='figure'>Example:</h6>
+ * <p class='bcode'>
+ * _enum(<js>"['foo','bar']"</js>);
+ * </p>
+ * <li><code>String</code> - Individual values
+ * <h6 class='figure'>Example:</h6>
+ * <p class='bcode'>
+ * _enum(<js>"foo"</js>, <js>"bar"</js>);
+ * </p>
+ * </ul>
+ * <br>Ignored if <jk>null</jk>.
* @return This object (for method chaining).
*/
- public SchemaInfo _enum(Object..._enum) {
- return addEnum(_enum);
+ public SchemaInfo _enum(Object...values) {
+ _enum = addToList(_enum, values, Object.class);
+ return this;
}
/**
* Bean property getter: <property>type</property>.
*
- * @return The value of the <property>type</property> property on this bean, or <jk>null</jk> if it is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public String getType() {
return type;
@@ -711,28 +817,33 @@ public class SchemaInfo extends SwaggerElement {
/**
* Bean property setter: <property>type</property>.
*
- * @param type The new value for the <property>type</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setType(String type) {
- this.type = type;
+ public SchemaInfo setType(String value) {
+ type = value;
return this;
}
/**
- * Synonym for {@link #setType(String)}.
+ * Same as {@link #setType(String)}.
*
- * @param type The new value for the <property>type</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Non-String values will be converted to String using <code>toString()</code>.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo type(String type) {
- return setType(type);
+ public SchemaInfo type(Object value) {
+ return setType(toStringVal(value));
}
/**
* Bean property getter: <property>items</property>.
*
- * @return The value of the <property>items</property> property on this bean, or <jk>null</jk> if it is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public Items getItems() {
return items;
@@ -741,28 +852,41 @@ public class SchemaInfo extends SwaggerElement {
/**
* Bean property setter: <property>items</property>.
*
- * @param items The new value for the <property>items</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setItems(Items items) {
- this.items = items;
+ public SchemaInfo setItems(Items value) {
+ items = value;
return this;
}
/**
- * Synonym for {@link #setItems(Items)}.
+ * Same as {@link #setItems(Items)}.
*
- * @param items The new value for the <property>items</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Valid types:
+ * <ul>
+ * <li>{@link Items}
+ * <li><code>String</code> - JSON object representation of {@link Items}
+ * <h6 class='figure'>Example:</h6>
+ * <p class='bcode'>
+ * items(<js>"{type:'type',format:'format',...}"</js>);
+ * </p>
+ * </ul>
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo items(Items items) {
- return setItems(items);
+ public SchemaInfo items(Object value) {
+ return setItems(toType(value, Items.class));
}
/**
* Bean property getter: <property>allOf</property>.
*
- * @return The value of the <property>allOf</property> property on this bean, or <jk>null</jk> if it is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public List<Object> getAllOf() {
return allOf;
@@ -771,53 +895,61 @@ public class SchemaInfo extends SwaggerElement {
/**
* Bean property setter: <property>allOf</property>.
*
- * @param allOf The new value for the <property>allOf</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setAllOf(List<Object> allOf) {
- this.allOf = allOf;
+ public SchemaInfo setAllOf(Collection<Object> value) {
+ allOf = newList(value);
return this;
}
/**
- * Bean property adder: <property>enum</property>.
+ * Adds one or more values to the <property>allOf</property> property.
*
- * @param allOf
- * The new values to add to the <property>allOf</property> property on this bean.
- * These can either be individual objects or {@link Collection Collections} of objects.
+ * @param values
+ * The values to add to this property.
+ * <br>Ignored if <jk>null</jk>.
* @return This object (for method chaining).
*/
- public SchemaInfo addAllOf(Object...allOf) {
- for (Object o : allOf) {
- if (o != null) {
- if (o instanceof Collection)
- addAllOf((Collection<Object>)o);
- else {
- if (this.allOf == null)
- this.allOf = new LinkedList<>();
- this.allOf.add(o);
- }
- }
- }
+ public SchemaInfo addAllOf(Collection<Object> values) {
+ allOf = addToList(allOf, values);
return this;
}
/**
- * Synonym for {@link #addAllOf(Object...)}.
- *
- * @param allOf
- * The new values to add to the <property>allOf</property> property on this bean.
- * These can either be individual objects or {@link Collection Collections} of objects.
+ * Adds one or more values to the <property>allOf</property> property.
+ *
+ * @param values
+ * The values to add to this property.
+ * <br>Valid types:
+ * <ul>
+ * <li><code>Object</code>
+ * <li><code>Collection<Object></code>
+ * <li><code>String</code> - JSON array representation of <code>Collection<Object></code>
+ * <h6 class='figure'>Example:</h6>
+ * <p class='bcode'>
+ * allOf(<js>"['foo','bar']"</js>);
+ * </p>
+ * <li><code>String</code> - Individual values
+ * <h6 class='figure'>Example:</h6>
+ * <p class='bcode'>
+ * allOf(<js>"foo"</js>, <js>"bar"</js>);
+ * </p>
+ * </ul>
+ * <br>Ignored if <jk>null</jk>.
* @return This object (for method chaining).
*/
- public SchemaInfo allOf(Object...allOf) {
- return addAllOf(allOf);
+ public SchemaInfo allOf(Object...values) {
+ allOf = addToList(allOf, values, Object.class);
+ return this;
}
/**
* Bean property getter: <property>properties</property>.
*
- * @return The value of the <property>properties</property> property on this bean, or <jk>null</jk> if it is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public Map<String,Map<String,Object>> getProperties() {
return properties;
@@ -826,50 +958,56 @@ public class SchemaInfo extends SwaggerElement {
/**
* Bean property setter: <property>properties</property>.
*
- * @param properties The new value for the <property>properties</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setProperties(Map<String,Map<String,Object>> properties) {
- this.properties = properties;
+ public SchemaInfo setProperties(Map<String,Map<String,Object>> value) {
+ properties = newMap(value);
return this;
}
/**
- * Bean property setter: <property>properties</property>.
+ * Adds one or more values to the <property>properties</property> property.
*
- * @param name The property name.
- * @param propertyProperties The properties of the property.
+ * @param values
+ * The values to add to this property.
+ * <br>Ignored if <jk>null</jk>.
* @return This object (for method chaining).
*/
- public SchemaInfo addProperty(String name, Map<String,Object> propertyProperties) {
- if (this.properties == null)
- this.properties = new TreeMap<>();
- this.properties.put(name, propertyProperties);
+ public SchemaInfo addProperties(Map<String,Map<String,Object>> values) {
+ properties = addToMap(properties, values);
return this;
}
/**
- * Synonym for {@link #addProperty(String,Map)}.
+ * Adds one or more values to the <property>properties</property> property.
*
- * @param name The property name.
- * @param propertyProperties The properties of the property.
+ * @param values
+ * The values to add to this property.
+ * <br>Valid types:
+ * <ul>
+ * <li><code>Map<String,Map<String,Object>></code>
+ * <li><code>String</code> - JSON object representation of <code>Map<String,Map<String,Object>></code>
+ * <h6 class='figure'>Example:</h6>
+ * <p class='bcode'>
+ * properties(<js>"{name:{foo:'bar'}}"</js>);
+ * </p>
+ * </ul>
+ * <br>Ignored if <jk>null</jk>.
* @return This object (for method chaining).
*/
- public SchemaInfo property(String name, Object...propertyProperties) {
- if (propertyProperties.length % 2 != 0)
- throw new RuntimeException("Invalid number of arguments passed to SchemaInfo.property(String,Object...)");
- Map<String,Object> m = new LinkedHashMap<>();
- for (int i = 0; i < propertyProperties.length; i += 2)
- m.put(String.valueOf(propertyProperties[i]), propertyProperties[i+1]);
- return addProperty(name, m);
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public SchemaInfo properties(Object...values) {
+ properties = addToMap((Map)properties, values, String.class, Map.class, String.class, Object.class);
+ return this;
}
/**
* Bean property getter: <property>additionalProperties</property>.
*
- * @return
- * The value of the <property>additionalProperties</property> property on this bean, or <jk>null</jk> if it
- * is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public Map<String,Object> getAdditionalProperties() {
return additionalProperties;
@@ -878,35 +1016,67 @@ public class SchemaInfo extends SwaggerElement {
/**
* Bean property setter: <property>additionalProperties</property>.
*
- * @param additionalProperties The new value for the <property>additionalProperties</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setAdditionalProperties(Map<String,Object> additionalProperties) {
- this.additionalProperties = additionalProperties;
+ public SchemaInfo setAdditionalProperties(Map<String,Object> value) {
+ additionalProperties = newMap(value);
return this;
}
/**
- * Synonym for {@link #setAdditionalProperties(Map)}.
+ * Adds one or more values to the <property>additionalProperties</property> property.
*
- * @param additionalProperties The new value for the <property>additionalProperties</property> property on this bean.
+ * @param values
+ * The values to add to this property.
+ * <br>Ignored if <jk>null</jk>.
* @return This object (for method chaining).
*/
- public SchemaInfo additionalProperties(Object...additionalProperties) {
- if (additionalProperties.length % 2 != 0)
- throw new RuntimeException("Invalid number of arguments passed to SchemaInfo.additionalProperties(Object...)");
- Map<String,Object> m = new LinkedHashMap<>();
- for (int i = 0; i < additionalProperties.length; i += 2)
- m.put(String.valueOf(additionalProperties[i]), additionalProperties[i+1]);
- return setAdditionalProperties(m);
+ public SchemaInfo addAdditionalProperties(Map<String,Object> values) {
+ additionalProperties = addToMap(additionalProperties, values);
+ return this;
+ }
+
+ /**
+ * Adds a single value to the <property>additionalProperties</property> property.
+ *
+ * @param name The extra property name.
+ * @param value The extra property value.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo additionalProperty(String name, Object value) {
+ additionalProperties = addToMap(additionalProperties, name, value);
+ return this;
+ }
+
+ /**
+ * Adds one or more values to the <property>properties</property> property.
+ *
+ * @param values
+ * The values to add to this property.
+ * <br>Valid types:
+ * <ul>
+ * <li><code>Map<String,Object></code>
+ * <li><code>String</code> - JSON object representation of <code>Map<String,Object></code>
+ * <h6 class='figure'>Example:</h6>
+ * <p class='bcode'>
+ * extraProperties(<js>"{name:'value'}"</js>);
+ * </p>
+ * </ul>
+ * <br>Ignored if <jk>null</jk>.
+ * @return This object (for method chaining).
+ */
+ public SchemaInfo additionalProperties(Object...values) {
+ additionalProperties = addToMap(additionalProperties, values, String.class, Object.class);
+ return this;
}
/**
* Bean property getter: <property>discriminator</property>.
*
- * @return
- * The value of the <property>discriminator</property> property on this bean, or <jk>null</jk> if it is
- * not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public String getDiscriminator() {
return discriminator;
@@ -915,28 +1085,33 @@ public class SchemaInfo extends SwaggerElement {
/**
* Bean property setter: <property>discriminator</property>.
*
- * @param discriminator The new value for the <property>discriminator</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setDiscriminator(String discriminator) {
- this.discriminator = discriminator;
+ public SchemaInfo setDiscriminator(String value) {
+ discriminator = value;
return this;
}
/**
- * Synonym for {@link #setDiscriminator(String)}.
+ * Same as {@link #setDiscriminator(String)}.
*
- * @param discriminator The new value for the <property>discriminator</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Non-String values will be converted to String using <code>toString()</code>.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo discriminator(String discriminator) {
- return setDiscriminator(discriminator);
+ public SchemaInfo discriminator(Object value) {
+ return setDiscriminator(toStringVal(value));
}
/**
* Bean property getter: <property>readOnly</property>.
*
- * @return The value of the <property>readOnly</property> property on this bean, or <jk>null</jk> if it is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public Boolean getReadOnly() {
return readOnly;
@@ -945,28 +1120,33 @@ public class SchemaInfo extends SwaggerElement {
/**
* Bean property setter: <property>readOnly</property>.
*
- * @param readOnly The new value for the <property>readOnly</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setReadOnly(Boolean readOnly) {
- this.readOnly = readOnly;
+ public SchemaInfo setReadOnly(Boolean value) {
+ readOnly = value;
return this;
}
/**
- * Synonym for {@link #setReadOnly(Boolean)}.
+ * Same as {@link #setReadOnly(Boolean)}.
*
- * @param readOnly The new value for the <property>readOnly</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Non-boolean values will be converted to boolean using <code>Boolean.<jsm>valueOf</jsm>(value.toString())</code>.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo readOnly(Boolean readOnly) {
- return setReadOnly(readOnly);
+ public SchemaInfo readOnly(Object value) {
+ return setReadOnly(toBoolean(value));
}
/**
* Bean property getter: <property>xml</property>.
*
- * @return The value of the <property>xml</property> property on this bean, or <jk>null</jk> if it is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public Xml getXml() {
return xml;
@@ -975,30 +1155,41 @@ public class SchemaInfo extends SwaggerElement {
/**
* Bean property setter: <property>xml</property>.
*
- * @param xml The new value for the <property>xml</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setXml(Xml xml) {
- this.xml = xml;
+ public SchemaInfo setXml(Xml value) {
+ xml = value;
return this;
}
/**
- * Synonym for {@link #setXml(Xml)}.
+ * Same as {@link #setXml(Xml)}.
*
- * @param xml The new value for the <property>xml</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Valid types:
+ * <ul>
+ * <li>{@link Xml}
+ * <li><code>String</code> - JSON object representation of {@link Xml}
+ * <h6 class='figure'>Example:</h6>
+ * <p class='bcode'>
+ * xml(<js>"{name:'name',namespace:'namespace',...}"</js>);
+ * </p>
+ * </ul>
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo xml(Xml xml) {
- return setXml(xml);
+ public SchemaInfo xml(Object value) {
+ return setXml(toType(value, Xml.class));
}
/**
* Bean property getter: <property>externalDocs</property>.
*
- * @return
- * The value of the <property>externalDocs</property> property on this bean, or <jk>null</jk> if it is not
- * set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public ExternalDocumentation getExternalDocs() {
return externalDocs;
@@ -1007,28 +1198,41 @@ public class SchemaInfo extends SwaggerElement {
/**
* Bean property setter: <property>externalDocs</property>.
*
- * @param externalDocs The new value for the <property>externalDocs</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setExternalDocs(ExternalDocumentation externalDocs) {
- this.externalDocs = externalDocs;
+ public SchemaInfo setExternalDocs(ExternalDocumentation value) {
+ externalDocs = value;
return this;
}
/**
- * Synonym for {@link #setExternalDocs(ExternalDocumentation)}.
+ * Same as {@link #setExternalDocs(ExternalDocumentation)}.
*
- * @param externalDocs The new value for the <property>externalDocs</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Valid types:
+ * <ul>
+ * <li>{@link ExternalDocumentation}
+ * <li><code>String</code> - JSON object representation of {@link ExternalDocumentation}
+ * <h6 class='figure'>Example:</h6>
+ * <p class='bcode'>
+ * externalDocs(<js>"{description:'description',url:'url'}"</js>);
+ * </p>
+ * </ul>
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo externalDocs(ExternalDocumentation externalDocs) {
- return setExternalDocs(externalDocs);
+ public SchemaInfo externalDocs(Object value) {
+ return setExternalDocs(toType(value, ExternalDocumentation.class));
}
/**
* Bean property getter: <property>example</property>.
*
- * @return The value of the <property>example</property> property on this bean, or <jk>null</jk> if it is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public Object getExample() {
return example;
@@ -1037,21 +1241,103 @@ public class SchemaInfo extends SwaggerElement {
/**
* Bean property setter: <property>example</property>.
*
- * @param example The new value for the <property>example</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo setExample(Object example) {
- this.example = example;
+ public SchemaInfo setExample(Object value) {
+ example = value;
return this;
}
/**
- * Synonym for {@link #setExample(Object)}.
+ * Same as {@link #setExample(Object)}.
*
- * @param example The new value for the <property>example</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SchemaInfo example(Object example) {
- return setExample(example);
+ public SchemaInfo example(Object value) {
+ return setExample(value);
+ }
+
+ @Override /* SwaggerElement */
+ public <T> T get(String property, Class<T> type) {
+ if (property == null)
+ return null;
+ switch (property) {
+ case "format": return toType(getFormat(), type);
+ case "title": return toType(getTitle(), type);
+ case "description": return toType(getDescription(), type);
+ case "default": return toType(getDefault(), type);
+ case "multipleOf": return toType(getMultipleOf(), type);
+ case "maximum": return toType(getMaximum(), type);
+ case "exclusiveMaximum": return toType(getExclusiveMaximum(), type);
+ case "minimum": return toType(getMinimum(), type);
+ case "exclusiveMinimum": return toType(getExclusiveMinimum(), type);
+ case "maxLength": return toType(getMaxLength(), type);
+ case "minLength": return toType(getMinLength(), type);
+ case "pattern": return toType(getPattern(), type);
+ case "maxItems": return toType(getMaxItems(), type);
+ case "minItems": return toType(getMinItems(), type);
+ case "uniqueItems": return toType(getUniqueItems(), type);
+ case "maxProperties": return toType(getMaxProperties(), type);
+ case "minProperties": return toType(getMinProperties(), type);
+ case "required": return toType(getRequired(), type);
+ case "enum": return toType(getEnum(), type);
+ case "type": return toType(getType(), type);
+ case "items": return toType(getItems(), type);
+ case "allOf": return toType(getAllOf(), type);
+ case "properties": return toType(getProperties(), type);
+ case "additionalProperties": return toType(getAdditionalProperties(), type);
+ case "discriminator": return toType(getDiscriminator(), type);
+ case "readOnly": return toType(getReadOnly(), type);
+ case "xml": return toType(getXml(), type);
+ case "externalDocs": return toType(getExternalDocs(), type);
+ case "example": return toType(getExample(), type);
+ default: return super.get(property, type);
+ }
+ }
+
+ @Override /* SwaggerElement */
+ public SchemaInfo set(String property, Object value) {
+ if (property == null)
+ return this;
+ switch (property) {
+ case "format": return format(value);
+ case "title": return title(value);
+ case "description": return description(value);
+ case "default": return _default(value);
+ case "multipleOf": return multipleOf(value);
+ case "maximum": return maximum(value);
+ case "exclusiveMaximum": return exclusiveMaximum(value);
+ case "minimum": return minimum(value);
+ case "exclusiveMinimum": return exclusiveMinimum(value);
+ case "maxLength": return maxLength(value);
+ case "minLength": return minLength(value);
+ case "pattern": return pattern(value);
+ case "maxItems": return maxItems(value);
+ case "minItems": return minItems(value);
+ case "uniqueItems": return uniqueItems(value);
+ case "maxProperties": return maxProperties(value);
+ case "minProperties": return minProperties(value);
+ case "required": return required(value);
+ case "enum": return setEnum(null)._enum(value);
+ case "type": return type(value);
+ case "items": return items(value);
+ case "allOf": return setAllOf(null).allOf(value);
+ case "properties": return setProperties(null).properties(value);
+ case "additionalProperties": return setAdditionalProperties(null).additionalProperties(value);
+ case "discriminator": return discriminator(value);
+ case "readOnly": return readOnly(value);
+ case "xml": return xml(value);
+ case "externalDocs": return externalDocs(value);
+ case "example": return example(value);
+ default:
+ super.set(property, value);
+ return this;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/juneau/blob/8df34f56/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/SecurityScheme.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/SecurityScheme.java b/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/SecurityScheme.java
index 5ef3383..92097de 100644
--- a/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/SecurityScheme.java
+++ b/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/SecurityScheme.java
@@ -12,6 +12,7 @@
// ***************************************************************************************************************************
package org.apache.juneau.dto.swagger;
+import static org.apache.juneau.internal.BeanPropertyUtils.*;
import static org.apache.juneau.internal.ArrayUtils.*;
import java.util.*;
@@ -54,31 +55,22 @@ import org.apache.juneau.annotation.*;
*
* <h6 class='topic'>Additional Information</h6>
* <ul class='doctree'>
- * <li class='link'>
- * <a class='doclink' href='../../../../../overview-summary.html#DTOs'>Juneau Data Transfer Objects
- * (org.apache.juneau.dto)</a>
- * <ul>
- * <li class='sublink'>
- * <a class='doclink' href='../../../../../overview-summary.html#DTOs.Swagger'>Swagger</a>
- * </ul>
- * </li>
- * <li class='jp'>
- * <a class='doclink' href='package-summary.html#TOC'>org.apache.juneau.dto.swagger</a>
- * </li>
+ * <li class='link'><a class='doclink' href='../../../../../overview-summary.html#juneau-dto.Swagger'>Overview > juneau-dto > Swagger</a>
* </ul>
*/
-@Bean(properties="type,description,name,in,flow,authorizationUrl,tokenUrl,scopes")
+@Bean(properties="type,description,name,in,flow,authorizationUrl,tokenUrl,scopes,*")
public class SecurityScheme extends SwaggerElement {
private static final String[] VALID_TYPES = {"basic", "apiKey", "oauth2"};
- private String type;
- private String description;
- private String name;
- private String in;
- private String flow;
- private String authorizationUrl;
- private String tokenUrl;
+ private String
+ type,
+ description,
+ name,
+ in,
+ flow,
+ authorizationUrl,
+ tokenUrl;
private Map<String,String> scopes;
@Override /* SwaggerElement */
@@ -91,12 +83,9 @@ public class SecurityScheme extends SwaggerElement {
* Bean property getter: <property>type</property>.
*
* <p>
- * Required. The type of the security scheme.
+ * The type of the security scheme.
*
- * <p>
- * Valid values are <js>"basic"</js>, <js>"apiKey"</js> or <js>"oauth2"</js>.
- *
- * @return The value of the <property>type</property> property on this bean, or <jk>null</jk> if it is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public String getType() {
return type;
@@ -106,32 +95,49 @@ public class SecurityScheme extends SwaggerElement {
* Bean property setter: <property>type</property>.
*
* <p>
- * Required. The type of the security scheme.
+ * The type of the security scheme.
*
* <p>
- * Valid values are <js>"basic"</js>, <js>"apiKey"</js> or <js>"oauth2"</js>.
- *
- * @param type The new value for the <property>type</property> property on this bean.
+ * Valid values are .
+ *
+ * @param value
+ * The new value for this property.
+ * <br>Valid values:
+ * <ul>
+ * <li><js>"basic"</js>
+ * <li><js>"apiKey"</js>
+ * <li><js>"oauth2"</js>
+ * </ul>
+ * <br>Property value is required.
* @return This object (for method chaining).
*/
- public SecurityScheme setType(String type) {
- if (isStrict() && ! contains(type, VALID_TYPES))
+ public SecurityScheme setType(String value) {
+ if (isStrict() && ! contains(value, VALID_TYPES))
throw new FormattedRuntimeException(
"Invalid value passed in to setType(String). Value=''{0}'', valid values={1}",
- type, VALID_TYPES
+ value, VALID_TYPES
);
- this.type = type;
+ type = value;
return this;
}
/**
- * Synonym for {@link #setType(String)}.
- *
- * @param type The new value for the <property>type</property> property on this bean.
+ * Same as {@link #setType(String)}.
+ *
+ * @param value
+ * The new value for this property.
+ * <br>Non-String values will be converted to String using <code>toString()</code>.
+ * <br>Valid values:
+ * <ul>
+ * <li><js>"basic"</js>
+ * <li><js>"apiKey"</js>
+ * <li><js>"oauth2"</js>
+ * </ul>
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SecurityScheme type(String type) {
- return setType(type);
+ public SecurityScheme type(Object value) {
+ return setType(toStringVal(value));
}
/**
@@ -140,8 +146,7 @@ public class SecurityScheme extends SwaggerElement {
* <p>
* A short description for security scheme.
*
- * @return
- * The value of the <property>description</property> property on this bean, or <jk>null</jk> if it is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public String getDescription() {
return description;
@@ -153,22 +158,27 @@ public class SecurityScheme extends SwaggerElement {
* <p>
* A short description for security scheme.
*
- * @param description The new value for the <property>description</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SecurityScheme setDescription(String description) {
- this.description = description;
+ public SecurityScheme setDescription(String value) {
+ description = value;
return this;
}
/**
- * Synonym for {@link #setDescription(String)}.
+ * Same as {@link #setDescription(String)}.
*
- * @param description The new value for the <property>description</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Non-String values will be converted to String using <code>toString()</code>.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SecurityScheme description(String description) {
- return setDescription(description);
+ public SecurityScheme description(Object value) {
+ return setDescription(toStringVal(value));
}
/**
@@ -177,7 +187,7 @@ public class SecurityScheme extends SwaggerElement {
* <p>
* The name of the header or query parameter to be used.
*
- * @return The value of the <property>name</property> property on this bean, or <jk>null</jk> if it is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public String getName() {
return name;
@@ -189,31 +199,36 @@ public class SecurityScheme extends SwaggerElement {
* <p>
* The name of the header or query parameter to be used.
*
- * @param name The new value for the <property>name</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SecurityScheme setName(String name) {
- this.name = name;
+ public SecurityScheme setName(String value) {
+ name = value;
return this;
}
/**
- * Synonym for {@link #setName(String)}.
+ * Same as {@link #setName(String)}.
*
- * @param name The new value for the <property>name</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Non-String values will be converted to String using <code>toString()</code>.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SecurityScheme name(String name) {
- return setName(name);
+ public SecurityScheme name(Object value) {
+ return setName(toStringVal(value));
}
/**
* Bean property getter: <property>in</property>.
*
* <p>
- * The location of the API key. Valid values are <js>"query"</js> or <js>"header"</js>.
+ * The location of the API key.
*
- * @return The value of the <property>in</property> property on this bean, or <jk>null</jk> if it is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public String getIn() {
return in;
@@ -223,24 +238,39 @@ public class SecurityScheme extends SwaggerElement {
* Bean property setter: <property>in</property>.
*
* <p>
- * The location of the API key. Valid values are <js>"query"</js> or <js>"header"</js>.
- *
- * @param in The new value for the <property>in</property> property on this bean.
+ * The location of the API key.
+ *
+ * @param value
+ * The new value for this property.
+ * <br>Valid values:
+ * <ul>
+ * <li><js>"query"</js>
+ * <li><js>"header"</js>
+ * </ul>
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SecurityScheme setIn(String in) {
- this.in = in;
+ public SecurityScheme setIn(String value) {
+ in = value;
return this;
}
/**
- * Synonym for {@link #setIn(String)}.
- *
- * @param in The new value for the <property>in</property> property on this bean.
+ * Same as {@link #setIn(String)}.
+ *
+ * @param value
+ * The new value for this property.
+ * <br>Non-String values will be converted to String using <code>toString()</code>.
+ * <br>Valid values:
+ * <ul>
+ * <li><js>"query"</js>
+ * <li><js>"header"</js>
+ * </ul>
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SecurityScheme in(String in) {
- return setIn(in);
+ public SecurityScheme in(Object value) {
+ return setIn(toStringVal(value));
}
/**
@@ -249,10 +279,7 @@ public class SecurityScheme extends SwaggerElement {
* <p>
* The flow used by the OAuth2 security scheme.
*
- * <p>
- * Valid values are <js>"implicit"</js>, <js>"password"</js>, <js>"application"</js> or <js>"accessCode"</js>.
- *
- * @return The value of the <property>flow</property> property on this bean, or <jk>null</jk> if it is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public String getFlow() {
return flow;
@@ -264,25 +291,41 @@ public class SecurityScheme extends SwaggerElement {
* <p>
* The flow used by the OAuth2 security scheme.
*
- * <p>
- * Valid values are <js>"implicit"</js>, <js>"password"</js>, <js>"application"</js> or <js>"accessCode"</js>.
- *
- * @param flow The new value for the <property>flow</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Valid values:
+ * <ul>
+ * <li><js>"implicit"</js>
+ * <li><js>"password"</js>
+ * <li><js>"application"</js>
+ * <li><js>"accessCode"</js>
+ * </ul>
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SecurityScheme setFlow(String flow) {
- this.flow = flow;
+ public SecurityScheme setFlow(String value) {
+ flow = value;
return this;
}
/**
- * Synonym for {@link #setFlow(String)}.
- *
- * @param flow The new value for the <property>flow</property> property on this bean.
+ * Same as {@link #setFlow(String)}.
+ *
+ * @param value
+ * The new value for this property.
+ * <br>Non-String values will be converted to String using <code>toString()</code>.
+ * <br>Valid values:
+ * <ul>
+ * <li><js>"implicit"</js>
+ * <li><js>"password"</js>
+ * <li><js>"application"</js>
+ * <li><js>"accessCode"</js>
+ * </ul>
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SecurityScheme flow(String flow) {
- return setFlow(flow);
+ public SecurityScheme flow(Object value) {
+ return setFlow(toStringVal(value));
}
/**
@@ -291,12 +334,7 @@ public class SecurityScheme extends SwaggerElement {
* <p>
* The authorization URL to be used for this flow.
*
- * <p>
- * This SHOULD be in the form of a URL.
- *
- * @return
- * The value of the <property>authorizationUrl</property> property on this bean, or <jk>null</jk> if it
- * is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public String getAuthorizationUrl() {
return authorizationUrl;
@@ -308,25 +346,29 @@ public class SecurityScheme extends SwaggerElement {
* <p>
* The authorization URL to be used for this flow.
*
- * <p>
- * This SHOULD be in the form of a URL.
- *
- * @param authorizationUrl The new value for the <property>authorizationUrl</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>This SHOULD be in the form of a URL.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SecurityScheme setAuthorizationUrl(String authorizationUrl) {
- this.authorizationUrl = authorizationUrl;
+ public SecurityScheme setAuthorizationUrl(String value) {
+ authorizationUrl = value;
return this;
}
/**
- * Synonym for {@link #setAuthorizationUrl(String)}.
+ * Same as {@link #setAuthorizationUrl(String)}.
*
- * @param authorizationUrl The new value for the <property>authorizationUrl</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Non-String values will be converted to String using <code>toString()</code>.
+ * <br>This SHOULD be in the form of a URL.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SecurityScheme authorizationUrl(String authorizationUrl) {
- return setAuthorizationUrl(authorizationUrl);
+ public SecurityScheme authorizationUrl(Object value) {
+ return setAuthorizationUrl(toStringVal(value));
}
/**
@@ -335,10 +377,7 @@ public class SecurityScheme extends SwaggerElement {
* <p>
* The token URL to be used for this flow.
*
- * <p>
- * This SHOULD be in the form of a URL.
- *
- * @return The value of the <property>tokenUrl</property> property on this bean, or <jk>null</jk> if it is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public String getTokenUrl() {
return tokenUrl;
@@ -350,25 +389,29 @@ public class SecurityScheme extends SwaggerElement {
* <p>
* The token URL to be used for this flow.
*
- * <p>
- * This SHOULD be in the form of a URL.
- *
- * @param tokenUrl The new value for the <property>tokenUrl</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>This SHOULD be in the form of a URL.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SecurityScheme setTokenUrl(String tokenUrl) {
- this.tokenUrl = tokenUrl;
+ public SecurityScheme setTokenUrl(String value) {
+ tokenUrl = value;
return this;
}
/**
- * Synonym for {@link #setTokenUrl(String)}.
+ * Same as {@link #setTokenUrl(String)}.
*
- * @param tokenUrl The new value for the <property>tokenUrl</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Non-String values will be converted to String using <code>toString()</code>.
+ * <br>This SHOULD be in the form of a URL.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SecurityScheme tokenUrl(String tokenUrl) {
- return setTokenUrl(tokenUrl);
+ public SecurityScheme tokenUrl(Object value) {
+ return setTokenUrl(toStringVal(value));
}
/**
@@ -377,7 +420,7 @@ public class SecurityScheme extends SwaggerElement {
* <p>
* The available scopes for the OAuth2 security scheme.
*
- * @return The value of the <property>scopes</property> property on this bean, or <jk>null</jk> if it is not set.
+ * @return The property value, or <jk>null</jk> if it is not set.
*/
public Map<String,String> getScopes() {
return scopes;
@@ -389,39 +432,84 @@ public class SecurityScheme extends SwaggerElement {
* <p>
* The available scopes for the OAuth2 security scheme.
*
- * @param scopes The new value for the <property>scopes</property> property on this bean.
+ * @param value
+ * The new value for this property.
+ * <br>Can be <jk>null</jk> to unset the property.
* @return This object (for method chaining).
*/
- public SecurityScheme setScopes(Map<String,String> scopes) {
- this.scopes = scopes;
+ public SecurityScheme setScopes(Map<String,String> value) {
+ scopes = newMap(value);
return this;
}
/**
- * Bean property adder: <property>scopes</property>.
- *
- * <p>
- * The available scopes for the OAuth2 security scheme.
+ * Adds one or more values to the <property>scopes</property> property.
*
- * @param name The name of the scope.
- * @param description A short description of the scope.
+ * @param values
+ * The values to add to this property.
+ * <br>Ignored if <jk>null</jk>.
* @return This object (for method chaining).
*/
- public SecurityScheme addScope(String name, String description) {
- if (scopes == null)
- scopes = new TreeMap<>();
- scopes.put(name, description);
+ public SecurityScheme addScopes(Map<String,String> values) {
+ scopes = addToMap(scopes, values);
return this;
}
-
+
/**
- * Synonym for {@link #addScope(String,String)}.
- *
- * @param name The name of the scope.
- * @param description A short description of the scope.
+ * Adds one or more values to the <property>enum</property> property.
+ *
+ * @param values
+ * The values to add to this property.
+ * <br>Valid types:
+ * <ul>
+ * <li><code>Map<String,{@link HeaderInfo}|String></code>
+ * <li><code>String</code> - JSON object representation of <code>Map<String,{@link HeaderInfo}></code>
+ * <h6 class='figure'>Example:</h6>
+ * <p class='bcode'>
+ * scopes(<js>"{name:'value'}"</js>);
+ * </p>
+ * </ul>
+ * <br>Ignored if <jk>null</jk>.
* @return This object (for method chaining).
*/
- public SecurityScheme scope(String name, String description) {
- return addScope(name, description);
+ public SecurityScheme scopes(Object...values) {
+ scopes = addToMap(scopes, values, String.class, String.class);
+ return this;
+ }
+
+ @Override /* SwaggerElement */
+ public <T> T get(String property, Class<T> type) {
+ if (property == null)
+ return null;
+ switch (property) {
+ case "type": return toType(getType(), type);
+ case "description": return toType(getDescription(), type);
+ case "name": return toType(getName(), type);
+ case "in": return toType(getIn(), type);
+ case "flow": return toType(getFlow(), type);
+ case "authorizationUrl": return toType(getAuthorizationUrl(), type);
+ case "tokenUrl": return toType(getTokenUrl(), type);
+ case "scopes": return toType(getScopes(), type);
+ default: return super.get(property, type);
+ }
+ }
+
+ @Override /* SwaggerElement */
+ public SecurityScheme set(String property, Object value) {
+ if (property == null)
+ return this;
+ switch (property) {
+ case "type": return type(value);
+ case "description": return description(value);
+ case "name": return name(value);
+ case "in": return in(value);
+ case "flow": return flow(value);
+ case "authorizationUrl": return authorizationUrl(value);
+ case "tokenUrl": return tokenUrl(value);
+ case "scopes": return setScopes(null).scopes(value);
+ default:
+ super.set(property, value);
+ return this;
+ }
}
}