This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new e8f92acc8b SonarQube bug fixes
e8f92acc8b is described below
commit e8f92acc8ba56c8bc3b2ae458e0d71a8f0c62d75
Author: James Bognar <[email protected]>
AuthorDate: Thu Feb 5 12:08:27 2026 -0500
SonarQube bug fixes
---
.../org/apache/juneau/bean/openapi3/Contact.java | 23 +-
.../apache/juneau/bean/openapi3/Discriminator.java | 16 +-
.../org/apache/juneau/bean/openapi3/Example.java | 30 ++-
.../bean/openapi3/ExternalDocumentation.java | 16 +-
.../org/apache/juneau/bean/openapi3/License.java | 16 +-
.../org/apache/juneau/bean/openapi3/MediaType.java | 30 ++-
.../org/apache/juneau/bean/openapi3/OAuthFlow.java | 30 ++-
.../apache/juneau/bean/openapi3/OAuthFlows.java | 30 ++-
.../org/apache/juneau/bean/openapi3/Response.java | 30 ++-
.../apache/juneau/bean/openapi3/SchemaInfo.java | 254 ++++++++++++---------
.../juneau/bean/openapi3/SecurityRequirement.java | 9 +-
.../org/apache/juneau/bean/openapi3/Server.java | 23 +-
.../juneau/bean/openapi3/ServerVariable.java | 23 +-
.../java/org/apache/juneau/bean/openapi3/Tag.java | 23 +-
.../java/org/apache/juneau/bean/openapi3/Xml.java | 37 +--
.../org/apache/juneau/bean/swagger/Contact.java | 23 +-
.../juneau/bean/swagger/ExternalDocumentation.java | 16 +-
.../org/apache/juneau/bean/swagger/HeaderInfo.java | 142 +++++++-----
.../java/org/apache/juneau/bean/swagger/Info.java | 51 +++--
.../java/org/apache/juneau/bean/swagger/Items.java | 128 ++++++-----
.../org/apache/juneau/bean/swagger/License.java | 16 +-
.../apache/juneau/bean/swagger/ParameterInfo.java | 177 ++++++++------
.../apache/juneau/bean/swagger/ResponseInfo.java | 30 ++-
.../org/apache/juneau/bean/swagger/SchemaInfo.java | 219 ++++++++++--------
.../apache/juneau/bean/swagger/SecurityScheme.java | 58 +++--
.../java/org/apache/juneau/bean/swagger/Tag.java | 23 +-
.../java/org/apache/juneau/bean/swagger/Xml.java | 37 +--
.../juneau/commons/collections/CacheMode.java | 11 +-
.../apache/juneau/commons/logging/LogRecord.java | 37 ++-
.../org/apache/juneau/httppart/HttpPartSchema.java | 96 +++++---
.../apache/juneau/rest/client/ResponseContent.java | 8 +-
.../juneau/rest/mock/MockServletResponse.java | 8 +-
.../java/org/apache/juneau/rest/RestContext.java | 33 +--
.../java/org/apache/juneau/rest/RestResponse.java | 8 +-
.../apache/juneau/rest/debug/DebugEnablement.java | 8 +-
35 files changed, 1024 insertions(+), 695 deletions(-)
diff --git
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Contact.java
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Contact.java
index b121a8e475..0ad9dd1fa0 100644
---
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Contact.java
+++
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Contact.java
@@ -76,6 +76,11 @@ public class Contact extends OpenApiElement {
// Argument name constants for assertArgNotNull
private static final String ARG_property = "property";
+ // Property name constants
+ private static final String PROP_email = "email";
+ private static final String PROP_name = "name";
+ private static final String PROP_url = "url";
+
private String name;
private URI url;
private String email;
@@ -111,9 +116,9 @@ public class Contact extends OpenApiElement {
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "name" -> toType(getName(), type);
- case "url" -> toType(getUrl(), type);
- case "email" -> toType(getEmail(), type);
+ case PROP_name -> toType(getName(), type);
+ case PROP_url -> toType(getUrl(), type);
+ case PROP_email -> toType(getEmail(), type);
default -> super.get(property, type);
};
}
@@ -152,9 +157,9 @@ public class Contact extends OpenApiElement {
public Set<String> keySet() {
// @formatter:off
var s = setb(String.class)
- .addIf(nn(email), "email")
- .addIf(nn(name), "name")
- .addIf(nn(url), "url")
+ .addIf(nn(email), PROP_email)
+ .addIf(nn(name), PROP_name)
+ .addIf(nn(url), PROP_url)
.build();
// @formatter:on
return new MultiSet<>(s, super.keySet());
@@ -164,9 +169,9 @@ public class Contact extends OpenApiElement {
public Contact set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "email" -> setEmail(s(value));
- case "name" -> setName(s(value));
- case "url" -> setUrl(toUri(value));
+ case PROP_email -> setEmail(s(value));
+ case PROP_name -> setName(s(value));
+ case PROP_url -> setUrl(toUri(value));
default -> {
super.set(property, value);
yield this;
diff --git
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Discriminator.java
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Discriminator.java
index 21a4e07c62..4080793cc0 100644
---
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Discriminator.java
+++
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Discriminator.java
@@ -80,6 +80,10 @@ public class Discriminator extends OpenApiElement {
private static final String ARG_property = "property";
private static final String ARG_value = "value";
+ // Property name constants
+ private static final String PROP_mapping = "mapping";
+ private static final String PROP_propertyName = "propertyName";
+
private String propertyName;
private Map<String,String> mapping = map();
@@ -127,8 +131,8 @@ public class Discriminator extends OpenApiElement {
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "propertyName" -> toType(getPropertyName(), type);
- case "mapping" -> toType(getMapping(), type);
+ case PROP_propertyName -> toType(getPropertyName(),
type);
+ case PROP_mapping -> toType(getMapping(), type);
default -> super.get(property, type);
};
}
@@ -157,8 +161,8 @@ public class Discriminator extends OpenApiElement {
public Set<String> keySet() {
// @formatter:off
var s = setb(String.class)
- .addIf(ne(mapping), "mapping")
- .addIf(nn(propertyName), "propertyName")
+ .addIf(ne(mapping), PROP_mapping)
+ .addIf(nn(propertyName), PROP_propertyName)
.build();
// @formatter:on
return new MultiSet<>(s, super.keySet());
@@ -168,8 +172,8 @@ public class Discriminator extends OpenApiElement {
public Discriminator set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "mapping" -> setMapping(toMapBuilder(value,
String.class, String.class).sparse().build());
- case "propertyName" -> setPropertyName(s(value));
+ case PROP_mapping -> setMapping(toMapBuilder(value,
String.class, String.class).sparse().build());
+ case PROP_propertyName -> setPropertyName(s(value));
default -> {
super.set(property, value);
yield this;
diff --git
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Example.java
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Example.java
index e8f7033d79..d21fcb12e8 100644
---
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Example.java
+++
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Example.java
@@ -77,6 +77,12 @@ public class Example extends OpenApiElement {
// Argument name constants for assertArgNotNull
private static final String ARG_property = "property";
+ // Property name constants
+ private static final String PROP_description = "description";
+ private static final String PROP_externalValue = "externalValue";
+ private static final String PROP_summary = "summary";
+ private static final String PROP_value = "value";
+
private String summary;
private String description;
private String externalValue;
@@ -114,10 +120,10 @@ public class Example extends OpenApiElement {
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "description" -> toType(getDescription(), type);
- case "externalValue" -> toType(getExternalValue(),
type);
- case "summary" -> toType(getSummary(), type);
- case "value" -> toType(getValue(), type);
+ case PROP_description -> toType(getDescription(), type);
+ case PROP_externalValue -> toType(getExternalValue(),
type);
+ case PROP_summary -> toType(getSummary(), type);
+ case PROP_value -> toType(getValue(), type);
default -> super.get(property, type);
};
}
@@ -170,10 +176,10 @@ public class Example extends OpenApiElement {
public Set<String> keySet() {
// @formatter:off
var s = setb(String.class)
- .addIf(nn(description), "description")
- .addIf(nn(externalValue), "externalValue")
- .addIf(nn(summary), "summary")
- .addIf(nn(value), "value")
+ .addIf(nn(description), PROP_description)
+ .addIf(nn(externalValue), PROP_externalValue)
+ .addIf(nn(summary), PROP_summary)
+ .addIf(nn(value), PROP_value)
.build();
// @formatter:on
return new MultiSet<>(s, super.keySet());
@@ -183,10 +189,10 @@ public class Example extends OpenApiElement {
public Example set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "description" -> setDescription(s(value));
- case "externalValue" -> setExternalValue(s(value));
- case "summary" -> setSummary(s(value));
- case "value" -> setValue(value);
+ case PROP_description -> setDescription(s(value));
+ case PROP_externalValue -> setExternalValue(s(value));
+ case PROP_summary -> setSummary(s(value));
+ case PROP_value -> setValue(value);
default -> {
super.set(property, value);
yield this;
diff --git
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/ExternalDocumentation.java
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/ExternalDocumentation.java
index d3725e5478..9c26f868e6 100644
---
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/ExternalDocumentation.java
+++
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/ExternalDocumentation.java
@@ -64,6 +64,10 @@ public class ExternalDocumentation extends OpenApiElement {
// Argument name constants for assertArgNotNull
private static final String ARG_property = "property";
+ // Property name constants
+ private static final String PROP_description = "description";
+ private static final String PROP_url = "url";
+
private String description;
private URI url;
@@ -97,8 +101,8 @@ public class ExternalDocumentation extends OpenApiElement {
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "description" -> toType(getDescription(), type);
- case "url" -> toType(getUrl(), type);
+ case PROP_description -> toType(getDescription(), type);
+ case PROP_url -> toType(getUrl(), type);
default -> super.get(property, type);
};
}
@@ -127,8 +131,8 @@ public class ExternalDocumentation extends OpenApiElement {
public Set<String> keySet() {
// @formatter:off
var s = setb(String.class)
- .addIf(nn(description), "description")
- .addIf(nn(url), "url")
+ .addIf(nn(description), PROP_description)
+ .addIf(nn(url), PROP_url)
.build();
// @formatter:on
return new MultiSet<>(s, super.keySet());
@@ -138,8 +142,8 @@ public class ExternalDocumentation extends OpenApiElement {
public ExternalDocumentation set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "description" -> setDescription(s(value));
- case "url" -> setUrl(toUri(value));
+ case PROP_description -> setDescription(s(value));
+ case PROP_url -> setUrl(toUri(value));
default -> {
super.set(property, value);
yield this;
diff --git
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/License.java
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/License.java
index 3e44a496c5..4818bbf3b2 100644
---
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/License.java
+++
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/License.java
@@ -74,6 +74,10 @@ public class License extends OpenApiElement {
// Argument name constants for assertArgNotNull
private static final String ARG_property = "property";
+ // Property name constants
+ private static final String PROP_name = "name";
+ private static final String PROP_url = "url";
+
private String name;
private URI url;
@@ -107,8 +111,8 @@ public class License extends OpenApiElement {
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "name" -> toType(getName(), type);
- case "url" -> toType(getUrl(), type);
+ case PROP_name -> toType(getName(), type);
+ case PROP_url -> toType(getUrl(), type);
default -> super.get(property, type);
};
}
@@ -137,8 +141,8 @@ public class License extends OpenApiElement {
public Set<String> keySet() {
// @formatter:off
var s = setb(String.class)
- .addIf(nn(name), "name")
- .addIf(nn(url), "url")
+ .addIf(nn(name), PROP_name)
+ .addIf(nn(url), PROP_url)
.build();
// @formatter:on
return new MultiSet<>(s, super.keySet());
@@ -148,8 +152,8 @@ public class License extends OpenApiElement {
public License set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "name" -> setName(s(value));
- case "url" -> setUrl(toUri(value));
+ case PROP_name -> setName(s(value));
+ case PROP_url -> setUrl(toUri(value));
default -> {
super.set(property, value);
yield this;
diff --git
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/MediaType.java
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/MediaType.java
index 0250a2d37a..de35721cdf 100644
---
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/MediaType.java
+++
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/MediaType.java
@@ -78,6 +78,12 @@ public class MediaType extends OpenApiElement {
private static final String ARG_property = "property";
private static final String ARG_value = "value";
+ // Property name constants
+ private static final String PROP_encoding = "encoding";
+ private static final String PROP_examples = "examples";
+ private static final String PROP_schema = "schema";
+ private static final String PROP_xExample = "x-example";
+
private SchemaInfo schema;
private Object example;
private Map<String,Example> examples = map();
@@ -147,10 +153,10 @@ public class MediaType extends OpenApiElement {
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "encoding" -> toType(getEncoding(), type);
- case "examples" -> toType(getExamples(), type);
- case "schema" -> toType(getSchema(), type);
- case "x-example" -> toType(getExample(), type);
+ case PROP_encoding -> toType(getEncoding(), type);
+ case PROP_examples -> toType(getExamples(), type);
+ case PROP_schema -> toType(getSchema(), type);
+ case PROP_xExample -> toType(getExample(), type);
default -> super.get(property, type);
};
}
@@ -191,10 +197,10 @@ public class MediaType extends OpenApiElement {
public Set<String> keySet() {
// @formatter:off
var s = setb(String.class)
- .addIf(ne(encoding), "encoding")
- .addIf(ne(examples), "examples")
- .addIf(nn(schema), "schema")
- .addIf(nn(example), "x-example")
+ .addIf(ne(encoding), PROP_encoding)
+ .addIf(ne(examples), PROP_examples)
+ .addIf(nn(schema), PROP_schema)
+ .addIf(nn(example), PROP_xExample)
.build();
// @formatter:on
return new MultiSet<>(s, super.keySet());
@@ -204,10 +210,10 @@ public class MediaType extends OpenApiElement {
public MediaType set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "encoding" -> setEncoding(toMapBuilder(value,
String.class, Encoding.class).sparse().build());
- case "examples" -> setExamples(toMapBuilder(value,
String.class, Example.class).sparse().build());
- case "schema" -> setSchema(toType(value,
SchemaInfo.class));
- case "x-example" -> setExample(value);
+ case PROP_encoding -> setEncoding(toMapBuilder(value,
String.class, Encoding.class).sparse().build());
+ case PROP_examples -> setExamples(toMapBuilder(value,
String.class, Example.class).sparse().build());
+ case PROP_schema -> setSchema(toType(value,
SchemaInfo.class));
+ case PROP_xExample -> setExample(value);
default -> {
super.set(property, value);
yield this;
diff --git
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/OAuthFlow.java
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/OAuthFlow.java
index b800d3444a..07458dbce4 100644
---
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/OAuthFlow.java
+++
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/OAuthFlow.java
@@ -83,6 +83,12 @@ public class OAuthFlow extends OpenApiElement {
private static final String ARG_name = "name";
private static final String ARG_property = "property";
+ // Property name constants
+ private static final String PROP_authorizationUrl = "authorizationUrl";
+ private static final String PROP_refreshUrl = "refreshUrl";
+ private static final String PROP_scopes = "scopes";
+ private static final String PROP_tokenUrl = "tokenUrl";
+
private String authorizationUrl;
private String tokenUrl;
private String refreshUrl;
@@ -135,10 +141,10 @@ public class OAuthFlow extends OpenApiElement {
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "refreshUrl" -> toType(getRefreshUrl(), type);
- case "tokenUrl" -> toType(getTokenUrl(), type);
- case "authorizationUrl" ->
toType(getAuthorizationUrl(), type);
- case "scopes" -> toType(getScopes(), type);
+ case PROP_refreshUrl -> toType(getRefreshUrl(), type);
+ case PROP_tokenUrl -> toType(getTokenUrl(), type);
+ case PROP_authorizationUrl ->
toType(getAuthorizationUrl(), type);
+ case PROP_scopes -> toType(getScopes(), type);
default -> super.get(property, type);
};
}
@@ -187,10 +193,10 @@ public class OAuthFlow extends OpenApiElement {
public Set<String> keySet() {
// @formatter:off
var s = setb(String.class)
- .addIf(nn(authorizationUrl), "authorizationUrl")
- .addIf(nn(refreshUrl), "refreshUrl")
- .addIf(ne(scopes), "scopes")
- .addIf(nn(tokenUrl), "tokenUrl")
+ .addIf(nn(authorizationUrl), PROP_authorizationUrl)
+ .addIf(nn(refreshUrl), PROP_refreshUrl)
+ .addIf(ne(scopes), PROP_scopes)
+ .addIf(nn(tokenUrl), PROP_tokenUrl)
.build();
// @formatter:on
return new MultiSet<>(s, super.keySet());
@@ -200,10 +206,10 @@ public class OAuthFlow extends OpenApiElement {
public OAuthFlow set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "authorizationUrl" ->
setAuthorizationUrl(s(value));
- case "refreshUrl" -> setRefreshUrl(s(value));
- case "scopes" -> setScopes(toMapBuilder(value,
String.class, String.class).sparse().build());
- case "tokenUrl" -> setTokenUrl(s(value));
+ case PROP_authorizationUrl ->
setAuthorizationUrl(s(value));
+ case PROP_refreshUrl -> setRefreshUrl(s(value));
+ case PROP_scopes -> setScopes(toMapBuilder(value,
String.class, String.class).sparse().build());
+ case PROP_tokenUrl -> setTokenUrl(s(value));
default -> {
super.set(property, value);
yield this;
diff --git
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/OAuthFlows.java
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/OAuthFlows.java
index 1785eb1c55..3f8f97daea 100644
---
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/OAuthFlows.java
+++
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/OAuthFlows.java
@@ -79,6 +79,12 @@ public class OAuthFlows extends OpenApiElement {
// Argument name constants for assertArgNotNull
private static final String ARG_property = "property";
+ // Property name constants
+ private static final String PROP_authorizationCode =
"authorizationCode";
+ private static final String PROP_clientCredentials =
"clientCredentials";
+ private static final String PROP_implicit = "implicit";
+ private static final String PROP_password = "password";
+
private OAuthFlow implicit;
private OAuthFlow password;
private OAuthFlow clientCredentials;
@@ -116,10 +122,10 @@ public class OAuthFlows extends OpenApiElement {
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "implicit" -> toType(getImplicit(), type);
- case "password" -> toType(getPassword(), type);
- case "clientCredentials" ->
toType(getClientCredentials(), type);
- case "authorizationCode" ->
toType(getAuthorizationCode(), type);
+ case PROP_implicit -> toType(getImplicit(), type);
+ case PROP_password -> toType(getPassword(), type);
+ case PROP_clientCredentials ->
toType(getClientCredentials(), type);
+ case PROP_authorizationCode ->
toType(getAuthorizationCode(), type);
default -> super.get(property, type);
};
}
@@ -168,10 +174,10 @@ public class OAuthFlows extends OpenApiElement {
public Set<String> keySet() {
// @formatter:off
var s = setb(String.class)
- .addIf(nn(authorizationCode), "authorizationCode")
- .addIf(nn(clientCredentials), "clientCredentials")
- .addIf(nn(implicit), "implicit")
- .addIf(nn(password), "password")
+ .addIf(nn(authorizationCode), PROP_authorizationCode)
+ .addIf(nn(clientCredentials), PROP_clientCredentials)
+ .addIf(nn(implicit), PROP_implicit)
+ .addIf(nn(password), PROP_password)
.build();
// @formatter:on
return new MultiSet<>(s, super.keySet());
@@ -181,10 +187,10 @@ public class OAuthFlows extends OpenApiElement {
public OAuthFlows set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "authorizationCode" ->
setAuthorizationCode(toType(value, OAuthFlow.class));
- case "clientCredentials" ->
setClientCredentials(toType(value, OAuthFlow.class));
- case "implicit" -> setImplicit(toType(value,
OAuthFlow.class));
- case "password" -> setPassword(toType(value,
OAuthFlow.class));
+ case PROP_authorizationCode ->
setAuthorizationCode(toType(value, OAuthFlow.class));
+ case PROP_clientCredentials ->
setClientCredentials(toType(value, OAuthFlow.class));
+ case PROP_implicit -> setImplicit(toType(value,
OAuthFlow.class));
+ case PROP_password -> setPassword(toType(value,
OAuthFlow.class));
default -> {
super.set(property, value);
yield this;
diff --git
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Response.java
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Response.java
index 3c8cded9a7..86600d0336 100644
---
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Response.java
+++
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Response.java
@@ -85,6 +85,12 @@ public class Response extends OpenApiElement {
private static final String ARG_property = "property";
private static final String ARG_value = "value";
+ // Property name constants
+ private static final String PROP_content = "content";
+ private static final String PROP_description = "description";
+ private static final String PROP_headers = "headers";
+ private static final String PROP_links = "links";
+
private String description;
private Map<String,HeaderInfo> headers = map();
private Map<String,MediaType> content = map();
@@ -167,10 +173,10 @@ public class Response extends OpenApiElement {
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "description" -> toType(getDescription(), type);
- case "content" -> toType(getContent(), type);
- case "headers" -> toType(getHeaders(), type);
- case "links" -> toType(getLinks(), type);
+ case PROP_description -> toType(getDescription(), type);
+ case PROP_content -> toType(getContent(), type);
+ case PROP_headers -> toType(getHeaders(), type);
+ case PROP_links -> toType(getLinks(), type);
default -> super.get(property, type);
};
}
@@ -243,10 +249,10 @@ public class Response extends OpenApiElement {
public Set<String> keySet() {
// @formatter:off
var s = setb(String.class)
- .addIf(ne(content), "content")
- .addIf(nn(description), "description")
- .addIf(ne(headers), "headers")
- .addIf(ne(links), "links")
+ .addIf(ne(content), PROP_content)
+ .addIf(nn(description), PROP_description)
+ .addIf(ne(headers), PROP_headers)
+ .addIf(ne(links), PROP_links)
.build();
// @formatter:on
return new MultiSet<>(s, super.keySet());
@@ -256,10 +262,10 @@ public class Response extends OpenApiElement {
public Response set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "content" -> setContent(toMapBuilder(value,
String.class, MediaType.class).sparse().build());
- case "description" -> setDescription(s(value));
- case "headers" -> setHeaders(toMapBuilder(value,
String.class, HeaderInfo.class).sparse().build());
- case "links" -> setLinks(toMapBuilder(value,
String.class, Link.class).sparse().build());
+ case PROP_content -> setContent(toMapBuilder(value,
String.class, MediaType.class).sparse().build());
+ case PROP_description -> setDescription(s(value));
+ case PROP_headers -> setHeaders(toMapBuilder(value,
String.class, HeaderInfo.class).sparse().build());
+ case PROP_links -> setLinks(toMapBuilder(value,
String.class, Link.class).sparse().build());
default -> {
super.set(property, value);
yield this;
diff --git
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/SchemaInfo.java
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/SchemaInfo.java
index 89fc2bcf8a..b04037d5d0 100644
---
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/SchemaInfo.java
+++
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/SchemaInfo.java
@@ -102,6 +102,44 @@ public class SchemaInfo extends OpenApiElement {
// Argument name constants for assertArgNotNull
private static final String ARG_property = "property";
+ // Property name constants
+ private static final String PROP_additionalProperties =
"additionalProperties";
+ private static final String PROP_allOf = "allOf";
+ private static final String PROP_anyOf = "anyOf";
+ private static final String PROP_default = "default";
+ private static final String PROP_deprecated = "deprecated";
+ private static final String PROP_description = "description";
+ private static final String PROP_discriminator = "discriminator";
+ private static final String PROP_enum = "enum";
+ private static final String PROP_example = "example";
+ private static final String PROP_exclusiveMaximum = "exclusiveMaximum";
+ private static final String PROP_exclusiveMinimum = "exclusiveMinimum";
+ private static final String PROP_externalDocs = "externalDocs";
+ private static final String PROP_format = "format";
+ private static final String PROP_items = "items";
+ private static final String PROP_maxItems = "maxItems";
+ private static final String PROP_maxLength = "maxLength";
+ private static final String PROP_maxProperties = "maxProperties";
+ private static final String PROP_maximum = "maximum";
+ private static final String PROP_minItems = "minItems";
+ private static final String PROP_minLength = "minLength";
+ private static final String PROP_minProperties = "minProperties";
+ private static final String PROP_minimum = "minimum";
+ private static final String PROP_multipleOf = "multipleOf";
+ private static final String PROP_not = "not";
+ private static final String PROP_nullable = "nullable";
+ private static final String PROP_oneOf = "oneOf";
+ private static final String PROP_pattern = "pattern";
+ private static final String PROP_properties = "properties";
+ private static final String PROP_readOnly = "readOnly";
+ private static final String PROP_required = "required";
+ private static final String PROP_title = "title";
+ private static final String PROP_type = "type";
+ private static final String PROP_uniqueItems = "uniqueItems";
+ private static final String PROP_writeOnly = "writeOnly";
+ private static final String PROP_xml = "xml";
+ private static final String PROP_ref = "$ref";
+
private String format;
private String title;
private String description;
@@ -361,42 +399,42 @@ public class SchemaInfo extends OpenApiElement {
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "format" -> toType(getFormat(), type);
- case "title" -> toType(getTitle(), type);
- case "description" -> toType(getDescription(), type);
- case "default" -> toType(getDefault(), type);
- case "multipleOf" -> toType(getMultipleOf(), type);
- case "maximum" -> toType(getMaximum(), type);
- case "exclusiveMaximum" ->
toType(getExclusiveMaximum(), type);
- case "minimum" -> toType(getMinimum(), type);
- case "exclusiveMinimum" ->
toType(getExclusiveMinimum(), type);
- case "maxLength" -> toType(getMaxLength(), type);
- case "minLength" -> toType(getMinLength(), type);
- case "pattern" -> toType(getPattern(), type);
- case "maxItems" -> toType(getMaxItems(), type);
- case "minItems" -> toType(getMinItems(), type);
- case "uniqueItems" -> toType(getUniqueItems(), type);
- case "maxProperties" -> toType(getMaxProperties(),
type);
- case "minProperties" -> toType(getMinProperties(),
type);
- case "required" -> toType(getRequired(), type);
- case "enum" -> toType(getEnum(), type);
- case "type" -> toType(getType(), type);
- case "items" -> toType(getItems(), type);
- case "allOf" -> toType(getAllOf(), type);
- case "oneOf" -> toType(getOneOf(), type);
- case "anyOf" -> toType(getAnyOf(), type);
- case "properties" -> toType(getProperties(), type);
- case "additionalProperties" ->
toType(getAdditionalProperties(), type);
- case "not" -> toType(getNot(), type);
- case "nullable" -> toType(getNullable(), type);
- case "deprecated" -> toType(getDeprecated(), type);
- case "discriminator" -> toType(getDiscriminator(),
type);
- case "readOnly" -> toType(getReadOnly(), type);
- case "writeOnly" -> toType(getWriteOnly(), type);
- case "xml" -> toType(getXml(), type);
- case "externalDocs" -> toType(getExternalDocs(), type);
- case "example" -> toType(getExample(), type);
- case "$ref" -> toType(getRef(), type);
+ case PROP_format -> toType(getFormat(), type);
+ case PROP_title -> toType(getTitle(), type);
+ case PROP_description -> toType(getDescription(), type);
+ case PROP_default -> toType(getDefault(), type);
+ case PROP_multipleOf -> toType(getMultipleOf(), type);
+ case PROP_maximum -> toType(getMaximum(), type);
+ case PROP_exclusiveMaximum ->
toType(getExclusiveMaximum(), type);
+ case PROP_minimum -> toType(getMinimum(), type);
+ case PROP_exclusiveMinimum ->
toType(getExclusiveMinimum(), type);
+ case PROP_maxLength -> toType(getMaxLength(), type);
+ case PROP_minLength -> toType(getMinLength(), type);
+ case PROP_pattern -> toType(getPattern(), type);
+ case PROP_maxItems -> toType(getMaxItems(), type);
+ case PROP_minItems -> toType(getMinItems(), type);
+ case PROP_uniqueItems -> toType(getUniqueItems(), type);
+ case PROP_maxProperties -> toType(getMaxProperties(),
type);
+ case PROP_minProperties -> toType(getMinProperties(),
type);
+ case PROP_required -> toType(getRequired(), type);
+ case PROP_enum -> toType(getEnum(), type);
+ case PROP_type -> toType(getType(), type);
+ case PROP_items -> toType(getItems(), type);
+ case PROP_allOf -> toType(getAllOf(), type);
+ case PROP_oneOf -> toType(getOneOf(), type);
+ case PROP_anyOf -> toType(getAnyOf(), type);
+ case PROP_properties -> toType(getProperties(), type);
+ case PROP_additionalProperties ->
toType(getAdditionalProperties(), type);
+ case PROP_not -> toType(getNot(), type);
+ case PROP_nullable -> toType(getNullable(), type);
+ case PROP_deprecated -> toType(getDeprecated(), type);
+ case PROP_discriminator -> toType(getDiscriminator(),
type);
+ case PROP_readOnly -> toType(getReadOnly(), type);
+ case PROP_writeOnly -> toType(getWriteOnly(), type);
+ case PROP_xml -> toType(getXml(), type);
+ case PROP_externalDocs -> toType(getExternalDocs(),
type);
+ case PROP_example -> toType(getExample(), type);
+ case PROP_ref -> toType(getRef(), type);
default -> super.get(property, type);
};
}
@@ -664,42 +702,42 @@ public class SchemaInfo extends OpenApiElement {
public Set<String> keySet() {
// @formatter:off
var s = setb(String.class)
- .addIf(nn(ref), "$ref")
- .addIf(nn(additionalProperties), "additionalProperties")
- .addIf(ne(allOf), "allOf")
- .addIf(ne(anyOf), "anyOf")
- .addIf(nn(default_), "default")
- .addIf(nn(deprecated), "deprecated")
- .addIf(nn(description), "description")
- .addIf(nn(discriminator), "discriminator")
- .addIf(ne(enum_), "enum")
- .addIf(nn(example), "example")
- .addIf(nn(exclusiveMaximum), "exclusiveMaximum")
- .addIf(nn(exclusiveMinimum), "exclusiveMinimum")
- .addIf(nn(externalDocs), "externalDocs")
- .addIf(nn(format), "format")
- .addIf(nn(items), "items")
- .addIf(nn(maxItems), "maxItems")
- .addIf(nn(maxLength), "maxLength")
- .addIf(nn(maxProperties), "maxProperties")
- .addIf(nn(maximum), "maximum")
- .addIf(nn(minItems), "minItems")
- .addIf(nn(minLength), "minLength")
- .addIf(nn(minProperties), "minProperties")
- .addIf(nn(minimum), "minimum")
- .addIf(nn(multipleOf), "multipleOf")
- .addIf(nn(not), "not")
- .addIf(nn(nullable), "nullable")
- .addIf(ne(oneOf), "oneOf")
- .addIf(nn(pattern), "pattern")
- .addIf(nn(properties), "properties")
- .addIf(nn(readOnly), "readOnly")
- .addIf(ne(required), "required")
- .addIf(nn(title), "title")
- .addIf(nn(type), "type")
- .addIf(nn(uniqueItems), "uniqueItems")
- .addIf(nn(writeOnly), "writeOnly")
- .addIf(nn(xml), "xml")
+ .addIf(nn(ref), PROP_ref)
+ .addIf(nn(additionalProperties),
PROP_additionalProperties)
+ .addIf(ne(allOf), PROP_allOf)
+ .addIf(ne(anyOf), PROP_anyOf)
+ .addIf(nn(default_), PROP_default)
+ .addIf(nn(deprecated), PROP_deprecated)
+ .addIf(nn(description), PROP_description)
+ .addIf(nn(discriminator), PROP_discriminator)
+ .addIf(ne(enum_), PROP_enum)
+ .addIf(nn(example), PROP_example)
+ .addIf(nn(exclusiveMaximum), PROP_exclusiveMaximum)
+ .addIf(nn(exclusiveMinimum), PROP_exclusiveMinimum)
+ .addIf(nn(externalDocs), PROP_externalDocs)
+ .addIf(nn(format), PROP_format)
+ .addIf(nn(items), PROP_items)
+ .addIf(nn(maxItems), PROP_maxItems)
+ .addIf(nn(maxLength), PROP_maxLength)
+ .addIf(nn(maxProperties), PROP_maxProperties)
+ .addIf(nn(maximum), PROP_maximum)
+ .addIf(nn(minItems), PROP_minItems)
+ .addIf(nn(minLength), PROP_minLength)
+ .addIf(nn(minProperties), PROP_minProperties)
+ .addIf(nn(minimum), PROP_minimum)
+ .addIf(nn(multipleOf), PROP_multipleOf)
+ .addIf(nn(not), PROP_not)
+ .addIf(nn(nullable), PROP_nullable)
+ .addIf(ne(oneOf), PROP_oneOf)
+ .addIf(nn(pattern), PROP_pattern)
+ .addIf(nn(properties), PROP_properties)
+ .addIf(nn(readOnly), PROP_readOnly)
+ .addIf(ne(required), PROP_required)
+ .addIf(nn(title), PROP_title)
+ .addIf(nn(type), PROP_type)
+ .addIf(nn(uniqueItems), PROP_uniqueItems)
+ .addIf(nn(writeOnly), PROP_writeOnly)
+ .addIf(nn(xml), PROP_xml)
.build();
// @formatter:on
return new MultiSet<>(s, super.keySet());
@@ -749,42 +787,42 @@ public class SchemaInfo extends OpenApiElement {
public SchemaInfo set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "$ref" -> setRef(value);
- case "additionalProperties" ->
setAdditionalProperties(toType(value, SchemaInfo.class));
- case "allOf" ->
setAllOf(listb(Object.class).addAny(value).sparse().build());
- case "anyOf" ->
setAnyOf(listb(Object.class).addAny(value).sparse().build());
- case "default" -> setDefault(value);
- case "deprecated" -> setDeprecated(toBoolean(value));
- case "description" -> setDescription(s(value));
- case "discriminator" -> setDiscriminator(toType(value,
Discriminator.class));
- case "enum" ->
setEnum(listb(Object.class).addAny(value).sparse().build());
- case "example" -> setExample(value);
- case "exclusiveMaximum" ->
setExclusiveMaximum(toBoolean(value));
- case "exclusiveMinimum" ->
setExclusiveMinimum(toBoolean(value));
- case "externalDocs" -> setExternalDocs(toType(value,
ExternalDocumentation.class));
- case "format" -> setFormat(s(value));
- case "items" -> setItems(toType(value, Items.class));
- case "maxItems" -> setMaxItems(toInteger(value));
- case "maxLength" -> setMaxLength(toInteger(value));
- case "maxProperties" ->
setMaxProperties(toInteger(value));
- case "maximum" -> setMaximum(toNumber(value));
- case "minItems" -> setMinItems(toInteger(value));
- case "minLength" -> setMinLength(toInteger(value));
- case "minProperties" ->
setMinProperties(toInteger(value));
- case "minimum" -> setMinimum(toNumber(value));
- case "multipleOf" -> setMultipleOf(toNumber(value));
- case "not" -> setNot(toType(value, SchemaInfo.class));
- case "nullable" -> setNullable(toBoolean(value));
- case "oneOf" ->
setOneOf(listb(Object.class).addAny(value).sparse().build());
- case "pattern" -> setPattern(s(value));
- case "properties" -> setProperties(toMapBuilder(value,
String.class, SchemaInfo.class).sparse().build());
- case "readOnly" -> setReadOnly(toBoolean(value));
- case "required" ->
setRequired(listb(String.class).addAny(value).sparse().build());
- case "title" -> setTitle(s(value));
- case "type" -> setType(s(value));
- case "uniqueItems" -> setUniqueItems(toBoolean(value));
- case "writeOnly" -> setWriteOnly(toBoolean(value));
- case "xml" -> setXml(toType(value, Xml.class));
+ case PROP_ref -> setRef(value);
+ case PROP_additionalProperties ->
setAdditionalProperties(toType(value, SchemaInfo.class));
+ case PROP_allOf ->
setAllOf(listb(Object.class).addAny(value).sparse().build());
+ case PROP_anyOf ->
setAnyOf(listb(Object.class).addAny(value).sparse().build());
+ case PROP_default -> setDefault(value);
+ case PROP_deprecated -> setDeprecated(toBoolean(value));
+ case PROP_description -> setDescription(s(value));
+ case PROP_discriminator ->
setDiscriminator(toType(value, Discriminator.class));
+ case PROP_enum ->
setEnum(listb(Object.class).addAny(value).sparse().build());
+ case PROP_example -> setExample(value);
+ case PROP_exclusiveMaximum ->
setExclusiveMaximum(toBoolean(value));
+ case PROP_exclusiveMinimum ->
setExclusiveMinimum(toBoolean(value));
+ case PROP_externalDocs -> setExternalDocs(toType(value,
ExternalDocumentation.class));
+ case PROP_format -> setFormat(s(value));
+ case PROP_items -> setItems(toType(value, Items.class));
+ case PROP_maxItems -> setMaxItems(toInteger(value));
+ case PROP_maxLength -> setMaxLength(toInteger(value));
+ case PROP_maxProperties ->
setMaxProperties(toInteger(value));
+ case PROP_maximum -> setMaximum(toNumber(value));
+ case PROP_minItems -> setMinItems(toInteger(value));
+ case PROP_minLength -> setMinLength(toInteger(value));
+ case PROP_minProperties ->
setMinProperties(toInteger(value));
+ case PROP_minimum -> setMinimum(toNumber(value));
+ case PROP_multipleOf -> setMultipleOf(toNumber(value));
+ case PROP_not -> setNot(toType(value,
SchemaInfo.class));
+ case PROP_nullable -> setNullable(toBoolean(value));
+ case PROP_oneOf ->
setOneOf(listb(Object.class).addAny(value).sparse().build());
+ case PROP_pattern -> setPattern(s(value));
+ case PROP_properties ->
setProperties(toMapBuilder(value, String.class,
SchemaInfo.class).sparse().build());
+ case PROP_readOnly -> setReadOnly(toBoolean(value));
+ case PROP_required ->
setRequired(listb(String.class).addAny(value).sparse().build());
+ case PROP_title -> setTitle(s(value));
+ case PROP_type -> setType(s(value));
+ case PROP_uniqueItems ->
setUniqueItems(toBoolean(value));
+ case PROP_writeOnly -> setWriteOnly(toBoolean(value));
+ case PROP_xml -> setXml(toType(value, Xml.class));
default -> {
super.set(property, value);
yield this;
diff --git
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/SecurityRequirement.java
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/SecurityRequirement.java
index b5bbeb23c0..a781b94ea9 100644
---
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/SecurityRequirement.java
+++
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/SecurityRequirement.java
@@ -39,6 +39,9 @@ public class SecurityRequirement extends OpenApiElement {
private static final String ARG_property = "property";
private static final String ARG_schemeName = "schemeName";
+ // Property name constants
+ private static final String PROP_requirements = "requirements";
+
private Map<String,List<String>> requirements;
/**
@@ -85,7 +88,7 @@ public class SecurityRequirement extends OpenApiElement {
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "requirements" -> toType(getRequirements(), type);
+ case PROP_requirements -> toType(getRequirements(),
type);
default -> super.get(property, type);
};
}
@@ -101,7 +104,7 @@ public class SecurityRequirement extends OpenApiElement {
public Set<String> keySet() {
// @formatter:off
var s = setb(String.class)
- .addIf(nn(requirements), "requirements")
+ .addIf(nn(requirements), PROP_requirements)
.build();
// @formatter:on
return new MultiSet<>(s, super.keySet());
@@ -112,7 +115,7 @@ public class SecurityRequirement extends OpenApiElement {
public SecurityRequirement set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "requirements" ->
setRequirements((Map<String,List<String>>)value);
+ case PROP_requirements ->
setRequirements((Map<String,List<String>>)value);
default -> {
super.set(property, value);
yield this;
diff --git
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Server.java
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Server.java
index 8def09012e..191e339ff0 100644
---
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Server.java
+++
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Server.java
@@ -79,6 +79,11 @@ public class Server extends OpenApiElement {
private static final String ARG_property = "property";
private static final String ARG_value = "value";
+ // Property name constants
+ private static final String PROP_description = "description";
+ private static final String PROP_url = "url";
+ private static final String PROP_variables = "variables";
+
private URI url;
private String description;
private Map<String,ServerVariable> variables = map();
@@ -132,9 +137,9 @@ public class Server extends OpenApiElement {
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "url" -> toType(getUrl(), type);
- case "description" -> toType(getDescription(), type);
- case "variables" -> toType(getVariables(), type);
+ case PROP_url -> toType(getUrl(), type);
+ case PROP_description -> toType(getDescription(), type);
+ case PROP_variables -> toType(getVariables(), type);
default -> super.get(property, type);
};
}
@@ -167,9 +172,9 @@ public class Server extends OpenApiElement {
public Set<String> keySet() {
// @formatter:off
var s = setb(String.class)
- .addIf(nn(description), "description")
- .addIf(nn(url), "url")
- .addIf(ne(variables), "variables")
+ .addIf(nn(description), PROP_description)
+ .addIf(nn(url), PROP_url)
+ .addIf(ne(variables), PROP_variables)
.build();
// @formatter:on
return new MultiSet<>(s, super.keySet());
@@ -179,9 +184,9 @@ public class Server extends OpenApiElement {
public Server set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "description" -> setDescription(s(value));
- case "url" -> setUrl(toUri(value));
- case "variables" -> setVariables(toMapBuilder(value,
String.class, ServerVariable.class).sparse().build());
+ case PROP_description -> setDescription(s(value));
+ case PROP_url -> setUrl(toUri(value));
+ case PROP_variables -> setVariables(toMapBuilder(value,
String.class, ServerVariable.class).sparse().build());
default -> {
super.set(property, value);
yield this;
diff --git
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/ServerVariable.java
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/ServerVariable.java
index bcd57a50e1..56201b5e9f 100644
---
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/ServerVariable.java
+++
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/ServerVariable.java
@@ -77,6 +77,11 @@ public class ServerVariable extends OpenApiElement {
// Argument name constants for assertArgNotNull
private static final String ARG_property = "property";
+ // Property name constants
+ private static final String PROP_default = "default";
+ private static final String PROP_description = "description";
+ private static final String PROP_enum = "enum";
+
private List<Object> enum_ = list();
private String default_;
private String description;
@@ -143,9 +148,9 @@ public class ServerVariable extends OpenApiElement {
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "enum" -> toType(getEnum(), type);
- case "default" -> toType(getDefault(), type);
- case "description" -> toType(getDescription(), type);
+ case PROP_enum -> toType(getEnum(), type);
+ case PROP_default -> toType(getDefault(), type);
+ case PROP_description -> toType(getDescription(), type);
default -> super.get(property, type);
};
}
@@ -197,9 +202,9 @@ public class ServerVariable extends OpenApiElement {
public Set<String> keySet() {
// @formatter:off
var s = setb(String.class)
- .addIf(nn(default_),"default" )
- .addIf(nn(description), "description")
- .addIf(ne(enum_), "enum")
+ .addIf(nn(default_), PROP_default)
+ .addIf(nn(description), PROP_description)
+ .addIf(ne(enum_), PROP_enum)
.build();
// @formatter:on
return new MultiSet<>(s, super.keySet());
@@ -209,9 +214,9 @@ public class ServerVariable extends OpenApiElement {
public ServerVariable set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "default" -> setDefault(s(value));
- case "description" -> setDescription(s(value));
- case "enum" ->
setEnum(listb(Object.class).addAny(value).sparse().build());
+ case PROP_default -> setDefault(s(value));
+ case PROP_description -> setDescription(s(value));
+ case PROP_enum ->
setEnum(listb(Object.class).addAny(value).sparse().build());
default -> {
super.set(property, value);
yield this;
diff --git
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Tag.java
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Tag.java
index df4bd42861..bab772be96 100644
---
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Tag.java
+++
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Tag.java
@@ -75,6 +75,11 @@ public class Tag extends OpenApiElement {
// Argument name constants for assertArgNotNull
private static final String ARG_property = "property";
+ // Property name constants
+ private static final String PROP_description = "description";
+ private static final String PROP_externalDocs = "externalDocs";
+ private static final String PROP_name = "name";
+
private String name;
private String description;
private ExternalDocumentation externalDocs;
@@ -110,9 +115,9 @@ public class Tag extends OpenApiElement {
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "name" -> toType(getName(), type);
- case "description" -> toType(getDescription(), type);
- case "externalDocs" -> toType(getExternalDocs(), type);
+ case PROP_name -> toType(getName(), type);
+ case PROP_description -> toType(getDescription(), type);
+ case PROP_externalDocs -> toType(getExternalDocs(),
type);
default -> super.get(property, type);
};
}
@@ -151,9 +156,9 @@ public class Tag extends OpenApiElement {
public Set<String> keySet() {
// @formatter:off
var s = setb(String.class)
- .addIf(nn(description), "description")
- .addIf(nn(externalDocs), "externalDocs")
- .addIf(nn(name), "name")
+ .addIf(nn(description), PROP_description)
+ .addIf(nn(externalDocs), PROP_externalDocs)
+ .addIf(nn(name), PROP_name)
.build();
// @formatter:on
return new MultiSet<>(s, super.keySet());
@@ -163,9 +168,9 @@ public class Tag extends OpenApiElement {
public Tag set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "description" -> setDescription(s(value));
- case "externalDocs" -> setExternalDocs(toType(value,
ExternalDocumentation.class));
- case "name" -> setName(s(value));
+ case PROP_description -> setDescription(s(value));
+ case PROP_externalDocs -> setExternalDocs(toType(value,
ExternalDocumentation.class));
+ case PROP_name -> setName(s(value));
default -> {
super.set(property, value);
yield this;
diff --git
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Xml.java
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Xml.java
index 07bc9b3f37..5b9b3d6592 100644
---
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Xml.java
+++
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Xml.java
@@ -75,6 +75,13 @@ public class Xml extends OpenApiElement {
// Argument name constants for assertArgNotNull
private static final String ARG_property = "property";
+ // Property name constants
+ private static final String PROP_attribute = "attribute";
+ private static final String PROP_namespace = "namespace";
+ private static final String PROP_prefix = "prefix";
+ private static final String PROP_name = "name";
+ private static final String PROP_wrapped = "wrapped";
+
private String name;
private String namespace;
private String prefix;
@@ -114,11 +121,11 @@ public class Xml extends OpenApiElement {
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "name" -> toType(getName(), type);
- case "namespace" -> toType(getNamespace(), type);
- case "prefix" -> toType(getPrefix(), type);
- case "attribute" -> toType(getAttribute(), type);
- case "wrapped" -> toType(getWrapped(), type);
+ case PROP_name -> toType(getName(), type);
+ case PROP_namespace -> toType(getNamespace(), type);
+ case PROP_prefix -> toType(getPrefix(), type);
+ case PROP_attribute -> toType(getAttribute(), type);
+ case PROP_wrapped -> toType(getWrapped(), type);
default -> super.get(property, type);
};
}
@@ -191,11 +198,11 @@ public class Xml extends OpenApiElement {
public Set<String> keySet() {
// @formatter:off
var s = setb(String.class)
- .addIf(nn(attribute), "attribute")
- .addIf(nn(name), "name")
- .addIf(nn(namespace), "namespace")
- .addIf(nn(prefix), "prefix")
- .addIf(nn(wrapped), "wrapped")
+ .addIf(nn(attribute), PROP_attribute)
+ .addIf(nn(name), PROP_name)
+ .addIf(nn(namespace), PROP_namespace)
+ .addIf(nn(prefix), PROP_prefix)
+ .addIf(nn(wrapped), PROP_wrapped)
.build();
// @formatter:on
return new MultiSet<>(s, super.keySet());
@@ -205,11 +212,11 @@ public class Xml extends OpenApiElement {
public Xml set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "attribute" -> setAttribute(toBoolean(value));
- case "name" -> setName(s(value));
- case "namespace" -> setNamespace(s(value));
- case "prefix" -> setPrefix(s(value));
- case "wrapped" -> setWrapped(toBoolean(value));
+ case PROP_attribute -> setAttribute(toBoolean(value));
+ case PROP_name -> setName(s(value));
+ case PROP_namespace -> setNamespace(s(value));
+ case PROP_prefix -> setPrefix(s(value));
+ case PROP_wrapped -> setWrapped(toBoolean(value));
default -> {
super.set(property, value);
yield this;
diff --git
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/Contact.java
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/Contact.java
index 7aecd0f476..fe8ba28743 100644
---
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/Contact.java
+++
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/Contact.java
@@ -75,6 +75,11 @@ public class Contact extends SwaggerElement {
// Argument name constants for assertArgNotNull
private static final String ARG_property = "property";
+ // Property name constants
+ private static final String PROP_email = "email";
+ private static final String PROP_name = "name";
+ private static final String PROP_url = "url";
+
private String name;
private URI url;
private String email;
@@ -110,9 +115,9 @@ public class Contact extends SwaggerElement {
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "email" -> toType(getEmail(), type);
- case "name" -> toType(getName(), type);
- case "url" -> toType(getUrl(), type);
+ case PROP_email -> toType(getEmail(), type);
+ case PROP_name -> toType(getName(), type);
+ case PROP_url -> toType(getUrl(), type);
default -> super.get(property, type);
};
}
@@ -151,9 +156,9 @@ public class Contact extends SwaggerElement {
public Set<String> keySet() {
// @formatter:off
var s = setb(String.class)
- .addIf(nn(email), "email")
- .addIf(nn(name), "name")
- .addIf(nn(url), "url")
+ .addIf(nn(email), PROP_email)
+ .addIf(nn(name), PROP_name)
+ .addIf(nn(url), PROP_url)
.build();
// @formatter:on
return new MultiSet<>(s, super.keySet());
@@ -163,9 +168,9 @@ public class Contact extends SwaggerElement {
public Contact set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "email" -> setEmail(s(value));
- case "name" -> setName(s(value));
- case "url" -> setUrl(toUri(value));
+ case PROP_email -> setEmail(s(value));
+ case PROP_name -> setName(s(value));
+ case PROP_url -> setUrl(toUri(value));
default -> {
super.set(property, value);
yield this;
diff --git
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/ExternalDocumentation.java
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/ExternalDocumentation.java
index 1ac3b2c96c..e8587670c9 100644
---
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/ExternalDocumentation.java
+++
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/ExternalDocumentation.java
@@ -75,6 +75,10 @@ public class ExternalDocumentation extends SwaggerElement {
// Argument name constants for assertArgNotNull
private static final String ARG_property = "property";
+ // Property name constants
+ private static final String PROP_description = "description";
+ private static final String PROP_url = "url";
+
private String description;
private URI url;
@@ -108,8 +112,8 @@ public class ExternalDocumentation extends SwaggerElement {
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "description" -> toType(getDescription(), type);
- case "url" -> toType(getUrl(), type);
+ case PROP_description -> toType(getDescription(), type);
+ case PROP_url -> toType(getUrl(), type);
default -> super.get(property, type);
};
}
@@ -138,8 +142,8 @@ public class ExternalDocumentation extends SwaggerElement {
public Set<String> keySet() {
// @formatter:off
var s = setb(String.class)
- .addIf(nn(description), "description")
- .addIf(nn(url), "url")
+ .addIf(nn(description), PROP_description)
+ .addIf(nn(url), PROP_url)
.build();
// @formatter:on
return new MultiSet<>(s, super.keySet());
@@ -149,8 +153,8 @@ public class ExternalDocumentation extends SwaggerElement {
public ExternalDocumentation set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "description" -> setDescription(s(value));
- case "url" -> setUrl(toUri(value));
+ case PROP_description -> setDescription(s(value));
+ case PROP_url -> setUrl(toUri(value));
default -> {
super.set(property, value);
yield this;
diff --git
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/HeaderInfo.java
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/HeaderInfo.java
index caa2a9a6cb..85dbf21780 100644
---
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/HeaderInfo.java
+++
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/HeaderInfo.java
@@ -84,6 +84,28 @@ public class HeaderInfo extends SwaggerElement {
// Argument name constants for assertArgNotNull
private static final String ARG_property = "property";
+ // Property name constants
+ private static final String PROP_collectionFormat = "collectionFormat";
+ private static final String PROP_default = "default";
+ private static final String PROP_description = "description";
+ private static final String PROP_example = "example";
+ private static final String PROP_exclusiveMaximum = "exclusiveMaximum";
+ private static final String PROP_exclusiveMinimum = "exclusiveMinimum";
+ private static final String PROP_format = "format";
+ private static final String PROP_items = "items";
+ private static final String PROP_maximum = "maximum";
+ private static final String PROP_maxItems = "maxItems";
+ private static final String PROP_maxLength = "maxLength";
+ private static final String PROP_minimum = "minimum";
+ private static final String PROP_minItems = "minItems";
+ private static final String PROP_minLength = "minLength";
+ private static final String PROP_multipleOf = "multipleOf";
+ private static final String PROP_pattern = "pattern";
+ private static final String PROP_enum = "enum";
+ private static final String PROP_type = "type";
+ private static final String PROP_$ref = "$ref";
+ private static final String PROP_uniqueItems = "uniqueItems";
+
private static final String[] VALID_TYPES = { "string", "number",
"integer", "boolean", "array" };
private static final String[] VALID_COLLECTION_FORMATS = { "csv",
"ssv", "tsv", "pipes", "multi" };
@@ -173,26 +195,26 @@ public class HeaderInfo extends SwaggerElement {
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "collectionFormat" ->
toType(getCollectionFormat(), type);
- case "default" -> toType(getDefault(), type);
- case "description" -> toType(getDescription(), type);
- case "enum" -> toType(getEnum(), type);
- case "example" -> toType(getExample(), type);
- case "exclusiveMaximum" ->
toType(getExclusiveMaximum(), type);
- case "exclusiveMinimum" ->
toType(getExclusiveMinimum(), type);
- case "format" -> toType(getFormat(), type);
- case "items" -> toType(getItems(), type);
- case "maximum" -> toType(getMaximum(), type);
- case "maxItems" -> toType(getMaxItems(), type);
- case "maxLength" -> toType(getMaxLength(), type);
- case "minimum" -> toType(getMinimum(), type);
- case "minItems" -> toType(getMinItems(), type);
- case "minLength" -> toType(getMinLength(), type);
- case "multipleOf" -> toType(getMultipleOf(), type);
- case "pattern" -> toType(getPattern(), type);
- case "$ref" -> toType(getRef(), type);
- case "type" -> toType(getType(), type);
- case "uniqueItems" -> toType(getUniqueItems(), type);
+ case PROP_collectionFormat ->
toType(getCollectionFormat(), type);
+ case PROP_default -> toType(getDefault(), type);
+ case PROP_description -> toType(getDescription(), type);
+ case PROP_enum -> toType(getEnum(), type);
+ case PROP_example -> toType(getExample(), type);
+ case PROP_exclusiveMaximum ->
toType(getExclusiveMaximum(), type);
+ case PROP_exclusiveMinimum ->
toType(getExclusiveMinimum(), type);
+ case PROP_format -> toType(getFormat(), type);
+ case PROP_items -> toType(getItems(), type);
+ case PROP_maximum -> toType(getMaximum(), type);
+ case PROP_maxItems -> toType(getMaxItems(), type);
+ case PROP_maxLength -> toType(getMaxLength(), type);
+ case PROP_minimum -> toType(getMinimum(), type);
+ case PROP_minItems -> toType(getMinItems(), type);
+ case PROP_minLength -> toType(getMinLength(), type);
+ case PROP_multipleOf -> toType(getMultipleOf(), type);
+ case PROP_pattern -> toType(getPattern(), type);
+ case PROP_$ref -> toType(getRef(), type);
+ case PROP_type -> toType(getType(), type);
+ case PROP_uniqueItems -> toType(getUniqueItems(), type);
default -> super.get(property, type);
};
}
@@ -367,26 +389,26 @@ public class HeaderInfo extends SwaggerElement {
public Set<String> keySet() {
// @formatter:off
var s = setb(String.class)
- .addIf(nn(ref), "$ref")
- .addIf(nn(collectionFormat), "collectionFormat")
- .addIf(nn(default_), "default")
- .addIf(nn(description), "description")
- .addIf(ne(enum_), "enum")
- .addIf(nn(example), "example")
- .addIf(nn(exclusiveMaximum), "exclusiveMaximum")
- .addIf(nn(exclusiveMinimum), "exclusiveMinimum")
- .addIf(nn(format), "format")
- .addIf(nn(items), "items")
- .addIf(nn(maxItems), "maxItems")
- .addIf(nn(maxLength), "maxLength")
- .addIf(nn(maximum), "maximum")
- .addIf(nn(minItems), "minItems")
- .addIf(nn(minLength), "minLength")
- .addIf(nn(minimum), "minimum")
- .addIf(nn(multipleOf), "multipleOf")
- .addIf(nn(pattern), "pattern")
- .addIf(nn(type), "type")
- .addIf(nn(uniqueItems), "uniqueItems")
+ .addIf(nn(ref), PROP_$ref)
+ .addIf(nn(collectionFormat), PROP_collectionFormat)
+ .addIf(nn(default_), PROP_default)
+ .addIf(nn(description), PROP_description)
+ .addIf(ne(enum_), PROP_enum)
+ .addIf(nn(example), PROP_example)
+ .addIf(nn(exclusiveMaximum), PROP_exclusiveMaximum)
+ .addIf(nn(exclusiveMinimum), PROP_exclusiveMinimum)
+ .addIf(nn(format), PROP_format)
+ .addIf(nn(items), PROP_items)
+ .addIf(nn(maxItems), PROP_maxItems)
+ .addIf(nn(maxLength), PROP_maxLength)
+ .addIf(nn(maximum), PROP_maximum)
+ .addIf(nn(minItems), PROP_minItems)
+ .addIf(nn(minLength), PROP_minLength)
+ .addIf(nn(minimum), PROP_minimum)
+ .addIf(nn(multipleOf), PROP_multipleOf)
+ .addIf(nn(pattern), PROP_pattern)
+ .addIf(nn(type), PROP_type)
+ .addIf(nn(uniqueItems), PROP_uniqueItems)
.build();
// @formatter:on
return new MultiSet<>(s, super.keySet());
@@ -426,26 +448,26 @@ public class HeaderInfo extends SwaggerElement {
public HeaderInfo set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "collectionFormat" ->
setCollectionFormat(s(value));
- case "default" -> setDefault(value);
- case "description" -> setDescription(s(value));
- case "enum" ->
setEnum(setb(Object.class).sparse().addAny(value).build());
- case "example" -> setExample(value);
- case "exclusiveMaximum" ->
setExclusiveMaximum(toBoolean(value));
- case "exclusiveMinimum" ->
setExclusiveMinimum(toBoolean(value));
- case "format" -> setFormat(s(value));
- case "items" -> setItems(toType(value, Items.class));
- case "maximum" -> setMaximum(toNumber(value));
- case "maxItems" -> setMaxItems(toInteger(value));
- case "maxLength" -> setMaxLength(toInteger(value));
- case "minimum" -> setMinimum(toNumber(value));
- case "minItems" -> setMinItems(toInteger(value));
- case "minLength" -> setMinLength(toInteger(value));
- case "multipleOf" -> setMultipleOf(toNumber(value));
- case "pattern" -> setPattern(s(value));
- case "$ref" -> setRef(s(value));
- case "type" -> setType(s(value));
- case "uniqueItems" -> setUniqueItems(toBoolean(value));
+ case PROP_collectionFormat ->
setCollectionFormat(s(value));
+ case PROP_default -> setDefault(value);
+ case PROP_description -> setDescription(s(value));
+ case PROP_enum ->
setEnum(setb(Object.class).sparse().addAny(value).build());
+ case PROP_example -> setExample(value);
+ case PROP_exclusiveMaximum ->
setExclusiveMaximum(toBoolean(value));
+ case PROP_exclusiveMinimum ->
setExclusiveMinimum(toBoolean(value));
+ case PROP_format -> setFormat(s(value));
+ case PROP_items -> setItems(toType(value, Items.class));
+ case PROP_maximum -> setMaximum(toNumber(value));
+ case PROP_maxItems -> setMaxItems(toInteger(value));
+ case PROP_maxLength -> setMaxLength(toInteger(value));
+ case PROP_minimum -> setMinimum(toNumber(value));
+ case PROP_minItems -> setMinItems(toInteger(value));
+ case PROP_minLength -> setMinLength(toInteger(value));
+ case PROP_multipleOf -> setMultipleOf(toNumber(value));
+ case PROP_pattern -> setPattern(s(value));
+ case PROP_$ref -> setRef(s(value));
+ case PROP_type -> setType(s(value));
+ case PROP_uniqueItems ->
setUniqueItems(toBoolean(value));
default -> {
super.set(property, value);
yield this;
diff --git
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/Info.java
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/Info.java
index 2a8cc9cde2..a512d2bc7d 100644
---
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/Info.java
+++
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/Info.java
@@ -95,6 +95,15 @@ public class Info extends SwaggerElement {
// Argument name constants for assertArgNotNull
private static final String ARG_property = "property";
+ // Property name constants
+ private static final String PROP_contact = "contact";
+ private static final String PROP_description = "description";
+ private static final String PROP_license = "license";
+ private static final String PROP_siteName = "siteName";
+ private static final String PROP_termsOfService = "termsOfService";
+ private static final String PROP_title = "title";
+ private static final String PROP_version = "version";
+
private String siteName;
private String title;
private String description;
@@ -138,13 +147,13 @@ public class Info extends SwaggerElement {
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "contact" -> toType(getContact(), type);
- case "description" -> toType(getDescription(), type);
- case "license" -> toType(getLicense(), type);
- case "siteName" -> toType(getSiteName(), type);
- case "termsOfService" -> toType(getTermsOfService(),
type);
- case "title" -> toType(getTitle(), type);
- case "version" -> toType(getVersion(), type);
+ case PROP_contact -> toType(getContact(), type);
+ case PROP_description -> toType(getDescription(), type);
+ case PROP_license -> toType(getLicense(), type);
+ case PROP_siteName -> toType(getSiteName(), type);
+ case PROP_termsOfService -> toType(getTermsOfService(),
type);
+ case PROP_title -> toType(getTitle(), type);
+ case PROP_version -> toType(getVersion(), type);
default -> super.get(property, type);
};
}
@@ -223,13 +232,13 @@ public class Info extends SwaggerElement {
public Set<String> keySet() {
// @formatter:off
var s = setb(String.class)
- .addIf(nn(contact), "contact")
- .addIf(nn(description), "description")
- .addIf(nn(license), "license")
- .addIf(nn(siteName), "siteName")
- .addIf(nn(termsOfService), "termsOfService")
- .addIf(nn(title), "title")
- .addIf(nn(version), "version")
+ .addIf(nn(contact), PROP_contact)
+ .addIf(nn(description), PROP_description)
+ .addIf(nn(license), PROP_license)
+ .addIf(nn(siteName), PROP_siteName)
+ .addIf(nn(termsOfService), PROP_termsOfService)
+ .addIf(nn(title), PROP_title)
+ .addIf(nn(version), PROP_version)
.build();
// @formatter:on
return new MultiSet<>(s, super.keySet());
@@ -239,13 +248,13 @@ public class Info extends SwaggerElement {
public Info set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "contact" -> setContact(toType(value,
Contact.class));
- case "description" -> setDescription(s(value));
- case "license" -> setLicense(toType(value,
License.class));
- case "siteName" -> setSiteName(s(value));
- case "termsOfService" -> setTermsOfService(s(value));
- case "title" -> setTitle(s(value));
- case "version" -> setVersion(s(value));
+ case PROP_contact -> setContact(toType(value,
Contact.class));
+ case PROP_description -> setDescription(s(value));
+ case PROP_license -> setLicense(toType(value,
License.class));
+ case PROP_siteName -> setSiteName(s(value));
+ case PROP_termsOfService -> setTermsOfService(s(value));
+ case PROP_title -> setTitle(s(value));
+ case PROP_version -> setVersion(s(value));
default -> {
super.set(property, value);
yield this;
diff --git
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/Items.java
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/Items.java
index a1aaeb5a33..b91c489b28 100644
---
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/Items.java
+++
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/Items.java
@@ -83,6 +83,26 @@ public class Items extends SwaggerElement {
// Argument name constants for assertArgNotNull
private static final String ARG_property = "property";
+ // Property name constants
+ private static final String PROP_collectionFormat = "collectionFormat";
+ private static final String PROP_default = "default";
+ private static final String PROP_exclusiveMaximum = "exclusiveMaximum";
+ private static final String PROP_exclusiveMinimum = "exclusiveMinimum";
+ private static final String PROP_format = "format";
+ private static final String PROP_items = "items";
+ private static final String PROP_maximum = "maximum";
+ private static final String PROP_maxItems = "maxItems";
+ private static final String PROP_maxLength = "maxLength";
+ private static final String PROP_minimum = "minimum";
+ private static final String PROP_minItems = "minItems";
+ private static final String PROP_minLength = "minLength";
+ private static final String PROP_multipleOf = "multipleOf";
+ private static final String PROP_pattern = "pattern";
+ private static final String PROP_enum = "enum";
+ private static final String PROP_type = "type";
+ private static final String PROP_$ref = "$ref";
+ private static final String PROP_uniqueItems = "uniqueItems";
+
private static final String[] VALID_TYPES = { "string", "number",
"integer", "boolean", "array" };
private static final String[] VALID_COLLECTION_FORMATS = { "csv",
"ssv", "tsv", "pipes", "multi" };
@@ -168,24 +188,24 @@ public class Items extends SwaggerElement {
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "collectionFormat" ->
toType(getCollectionFormat(), type);
- case "default" -> toType(getDefault(), type);
- case "enum" -> toType(getEnum(), type);
- case "exclusiveMaximum" ->
toType(getExclusiveMaximum(), type);
- case "exclusiveMinimum" ->
toType(getExclusiveMinimum(), type);
- case "format" -> toType(getFormat(), type);
- case "items" -> toType(getItems(), type);
- case "maximum" -> toType(getMaximum(), type);
- case "maxItems" -> toType(getMaxItems(), type);
- case "maxLength" -> toType(getMaxLength(), type);
- case "minimum" -> toType(getMinimum(), type);
- case "minItems" -> toType(getMinItems(), type);
- case "minLength" -> toType(getMinLength(), type);
- case "multipleOf" -> toType(getMultipleOf(), type);
- case "pattern" -> toType(getPattern(), type);
- case "$ref" -> toType(getRef(), type);
- case "type" -> toType(getType(), type);
- case "uniqueItems" -> toType(getUniqueItems(), type);
+ case PROP_collectionFormat ->
toType(getCollectionFormat(), type);
+ case PROP_default -> toType(getDefault(), type);
+ case PROP_enum -> toType(getEnum(), type);
+ case PROP_exclusiveMaximum ->
toType(getExclusiveMaximum(), type);
+ case PROP_exclusiveMinimum ->
toType(getExclusiveMinimum(), type);
+ case PROP_format -> toType(getFormat(), type);
+ case PROP_items -> toType(getItems(), type);
+ case PROP_maximum -> toType(getMaximum(), type);
+ case PROP_maxItems -> toType(getMaxItems(), type);
+ case PROP_maxLength -> toType(getMaxLength(), type);
+ case PROP_minimum -> toType(getMinimum(), type);
+ case PROP_minItems -> toType(getMinItems(), type);
+ case PROP_minLength -> toType(getMinLength(), type);
+ case PROP_multipleOf -> toType(getMultipleOf(), type);
+ case PROP_pattern -> toType(getPattern(), type);
+ case PROP_$ref -> toType(getRef(), type);
+ case PROP_type -> toType(getType(), type);
+ case PROP_uniqueItems -> toType(getUniqueItems(), type);
default -> super.get(property, type);
};
}
@@ -343,24 +363,24 @@ public class Items extends SwaggerElement {
public Set<String> keySet() {
// @formatter:off
var s = setb(String.class)
- .addIf(nn(ref), "$ref")
- .addIf(nn(collectionFormat), "collectionFormat")
- .addIf(nn(default_), "default")
- .addIf(ne(enum_), "enum")
- .addIf(nn(exclusiveMaximum), "exclusiveMaximum")
- .addIf(nn(exclusiveMinimum), "exclusiveMinimum")
- .addIf(nn(format), "format")
- .addIf(nn(items), "items")
- .addIf(nn(maxItems), "maxItems")
- .addIf(nn(maxLength), "maxLength")
- .addIf(nn(maximum), "maximum")
- .addIf(nn(minItems), "minItems")
- .addIf(nn(minLength), "minLength")
- .addIf(nn(minimum), "minimum")
- .addIf(nn(multipleOf), "multipleOf")
- .addIf(nn(pattern), "pattern")
- .addIf(nn(type), "type")
- .addIf(nn(uniqueItems), "uniqueItems")
+ .addIf(nn(ref), PROP_$ref)
+ .addIf(nn(collectionFormat), PROP_collectionFormat)
+ .addIf(nn(default_), PROP_default)
+ .addIf(ne(enum_), PROP_enum)
+ .addIf(nn(exclusiveMaximum), PROP_exclusiveMaximum)
+ .addIf(nn(exclusiveMinimum), PROP_exclusiveMinimum)
+ .addIf(nn(format), PROP_format)
+ .addIf(nn(items), PROP_items)
+ .addIf(nn(maxItems), PROP_maxItems)
+ .addIf(nn(maxLength), PROP_maxLength)
+ .addIf(nn(maximum), PROP_maximum)
+ .addIf(nn(minItems), PROP_minItems)
+ .addIf(nn(minLength), PROP_minLength)
+ .addIf(nn(minimum), PROP_minimum)
+ .addIf(nn(multipleOf), PROP_multipleOf)
+ .addIf(nn(pattern), PROP_pattern)
+ .addIf(nn(type), PROP_type)
+ .addIf(nn(uniqueItems), PROP_uniqueItems)
.build();
// @formatter:on
return new MultiSet<>(s, super.keySet());
@@ -400,24 +420,24 @@ public class Items extends SwaggerElement {
public Items set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "collectionFormat" ->
setCollectionFormat(s(value));
- case "default" -> setDefault(value);
- case "enum" ->
setEnum(listb(Object.class).addAny(value).sparse().build());
- case "exclusiveMaximum" ->
setExclusiveMaximum(toBoolean(value));
- case "exclusiveMinimum" ->
setExclusiveMinimum(toBoolean(value));
- case "format" -> setFormat(s(value));
- case "items" -> setItems(toType(value, Items.class));
- case "maximum" -> setMaximum(toNumber(value));
- case "maxItems" -> setMaxItems(toInteger(value));
- case "maxLength" -> setMaxLength(toInteger(value));
- case "minimum" -> setMinimum(toNumber(value));
- case "minItems" -> setMinItems(toInteger(value));
- case "minLength" -> setMinLength(toInteger(value));
- case "multipleOf" -> setMultipleOf(toNumber(value));
- case "pattern" -> setPattern(s(value));
- case "$ref" -> setRef(s(value));
- case "type" -> setType(s(value));
- case "uniqueItems" -> setUniqueItems(toBoolean(value));
+ case PROP_collectionFormat ->
setCollectionFormat(s(value));
+ case PROP_default -> setDefault(value);
+ case PROP_enum ->
setEnum(listb(Object.class).addAny(value).sparse().build());
+ case PROP_exclusiveMaximum ->
setExclusiveMaximum(toBoolean(value));
+ case PROP_exclusiveMinimum ->
setExclusiveMinimum(toBoolean(value));
+ case PROP_format -> setFormat(s(value));
+ case PROP_items -> setItems(toType(value, Items.class));
+ case PROP_maximum -> setMaximum(toNumber(value));
+ case PROP_maxItems -> setMaxItems(toInteger(value));
+ case PROP_maxLength -> setMaxLength(toInteger(value));
+ case PROP_minimum -> setMinimum(toNumber(value));
+ case PROP_minItems -> setMinItems(toInteger(value));
+ case PROP_minLength -> setMinLength(toInteger(value));
+ case PROP_multipleOf -> setMultipleOf(toNumber(value));
+ case PROP_pattern -> setPattern(s(value));
+ case PROP_$ref -> setRef(s(value));
+ case PROP_type -> setType(s(value));
+ case PROP_uniqueItems ->
setUniqueItems(toBoolean(value));
default -> {
super.set(property, value);
yield this;
diff --git
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/License.java
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/License.java
index 590a5af776..6f44652779 100644
---
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/License.java
+++
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/License.java
@@ -74,6 +74,10 @@ public class License extends SwaggerElement {
// Argument name constants for assertArgNotNull
private static final String ARG_property = "property";
+ // Property name constants
+ private static final String PROP_name = "name";
+ private static final String PROP_url = "url";
+
private String name;
private URI url;
@@ -107,8 +111,8 @@ public class License extends SwaggerElement {
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "name" -> toType(getName(), type);
- case "url" -> toType(getUrl(), type);
+ case PROP_name -> toType(getName(), type);
+ case PROP_url -> toType(getUrl(), type);
default -> super.get(property, type);
};
}
@@ -137,8 +141,8 @@ public class License extends SwaggerElement {
public Set<String> keySet() {
// @formatter:off
var s = setb(String.class)
- .addIf(nn(name), "name")
- .addIf(nn(url), "url")
+ .addIf(nn(name), PROP_name)
+ .addIf(nn(url), PROP_url)
.build();
// @formatter:on
return new MultiSet<>(s, super.keySet());
@@ -148,8 +152,8 @@ public class License extends SwaggerElement {
public License set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "name" -> setName(s(value));
- case "url" -> setUrl(toUri(value));
+ case PROP_name -> setName(s(value));
+ case PROP_url -> setUrl(toUri(value));
default -> {
super.set(property, value);
yield this;
diff --git
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/ParameterInfo.java
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/ParameterInfo.java
index 2ba1669f1d..7d360f6b36 100644
---
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/ParameterInfo.java
+++
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/ParameterInfo.java
@@ -126,6 +126,33 @@ public class ParameterInfo extends SwaggerElement {
// Argument name constants for assertArgNotNull
private static final String ARG_property = "property";
+ // Property name constants
+ private static final String PROP_allowEmptyValue = "allowEmptyValue";
+ private static final String PROP_collectionFormat = "collectionFormat";
+ private static final String PROP_default = "default";
+ private static final String PROP_description = "description";
+ private static final String PROP_example = "example";
+ private static final String PROP_examples = "examples";
+ private static final String PROP_exclusiveMaximum = "exclusiveMaximum";
+ private static final String PROP_exclusiveMinimum = "exclusiveMinimum";
+ private static final String PROP_format = "format";
+ private static final String PROP_items = "items";
+ private static final String PROP_maximum = "maximum";
+ private static final String PROP_maxItems = "maxItems";
+ private static final String PROP_maxLength = "maxLength";
+ private static final String PROP_minimum = "minimum";
+ private static final String PROP_minItems = "minItems";
+ private static final String PROP_minLength = "minLength";
+ private static final String PROP_multipleOf = "multipleOf";
+ private static final String PROP_pattern = "pattern";
+ private static final String PROP_required = "required";
+ private static final String PROP_schema = "schema";
+ private static final String PROP_enum = "enum";
+ private static final String PROP_in = "in";
+ private static final String PROP_name = "name";
+ private static final String PROP_type = "type";
+ private static final String PROP_uniqueItems = "uniqueItems";
+
private static final String[] VALID_IN = { "query", "header", "path",
"formData", "body" };
private static final String[] VALID_TYPES = { "string", "number",
"integer", "boolean", "array", "file" };
private static final String[] VALID_COLLECTION_FORMATS = { "csv",
"ssv", "tsv", "pipes", "multi" };
@@ -292,31 +319,31 @@ public class ParameterInfo extends SwaggerElement {
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "allowEmptyValue" -> toType(getAllowEmptyValue(),
type);
- case "collectionFormat" ->
toType(getCollectionFormat(), type);
- case "default" -> toType(getDefault(), type);
- case "description" -> toType(getDescription(), type);
- case "enum" -> toType(getEnum(), type);
- case "example" -> toType(getExample(), type);
- case "examples" -> toType(getExamples(), type);
- case "exclusiveMaximum" ->
toType(getExclusiveMaximum(), type);
- case "exclusiveMinimum" ->
toType(getExclusiveMinimum(), type);
- case "format" -> toType(getFormat(), type);
- case "in" -> toType(getIn(), type);
- case "items" -> toType(getItems(), type);
- case "maximum" -> toType(getMaximum(), type);
- case "maxItems" -> toType(getMaxItems(), type);
- case "maxLength" -> toType(getMaxLength(), type);
- case "minimum" -> toType(getMinimum(), type);
- case "minItems" -> toType(getMinItems(), type);
- case "minLength" -> toType(getMinLength(), type);
- case "multipleOf" -> toType(getMultipleOf(), type);
- case "name" -> toType(getName(), type);
- case "pattern" -> toType(getPattern(), type);
- case "required" -> toType(getRequired(), type);
- case "schema" -> toType(getSchema(), type);
- case "type" -> toType(getType(), type);
- case "uniqueItems" -> toType(getUniqueItems(), type);
+ case PROP_allowEmptyValue ->
toType(getAllowEmptyValue(), type);
+ case PROP_collectionFormat ->
toType(getCollectionFormat(), type);
+ case PROP_default -> toType(getDefault(), type);
+ case PROP_description -> toType(getDescription(), type);
+ case PROP_enum -> toType(getEnum(), type);
+ case PROP_example -> toType(getExample(), type);
+ case PROP_examples -> toType(getExamples(), type);
+ case PROP_exclusiveMaximum ->
toType(getExclusiveMaximum(), type);
+ case PROP_exclusiveMinimum ->
toType(getExclusiveMinimum(), type);
+ case PROP_format -> toType(getFormat(), type);
+ case PROP_in -> toType(getIn(), type);
+ case PROP_items -> toType(getItems(), type);
+ case PROP_maximum -> toType(getMaximum(), type);
+ case PROP_maxItems -> toType(getMaxItems(), type);
+ case PROP_maxLength -> toType(getMaxLength(), type);
+ case PROP_minimum -> toType(getMinimum(), type);
+ case PROP_minItems -> toType(getMinItems(), type);
+ case PROP_minLength -> toType(getMinLength(), type);
+ case PROP_multipleOf -> toType(getMultipleOf(), type);
+ case PROP_name -> toType(getName(), type);
+ case PROP_pattern -> toType(getPattern(), type);
+ case PROP_required -> toType(getRequired(), type);
+ case PROP_schema -> toType(getSchema(), type);
+ case PROP_type -> toType(getType(), type);
+ case PROP_uniqueItems -> toType(getUniqueItems(), type);
default -> super.get(property, type);
};
}
@@ -558,31 +585,31 @@ public class ParameterInfo extends SwaggerElement {
public Set<String> keySet() {
// @formatter:off
var s = setb(String.class)
- .addIf(nn(allowEmptyValue), "allowEmptyValue")
- .addIf(nn(collectionFormat), "collectionFormat")
- .addIf(nn(default_), "default")
- .addIf(nn(description), "description")
- .addIf(ne(enum_), "enum")
- .addIf(nn(example), "example")
- .addIf(nn(examples), "examples")
- .addIf(nn(exclusiveMaximum), "exclusiveMaximum")
- .addIf(nn(exclusiveMinimum), "exclusiveMinimum")
- .addIf(nn(format), "format")
- .addIf(nn(in), "in")
- .addIf(nn(items), "items")
- .addIf(nn(maxItems), "maxItems")
- .addIf(nn(maxLength), "maxLength")
- .addIf(nn(maximum), "maximum")
- .addIf(nn(minItems), "minItems")
- .addIf(nn(minLength), "minLength")
- .addIf(nn(minimum), "minimum")
- .addIf(nn(multipleOf), "multipleOf")
- .addIf(nn(name), "name")
- .addIf(nn(pattern), "pattern")
- .addIf(nn(required), "required")
- .addIf(nn(schema), "schema")
- .addIf(nn(type), "type")
- .addIf(nn(uniqueItems), "uniqueItems")
+ .addIf(nn(allowEmptyValue), PROP_allowEmptyValue)
+ .addIf(nn(collectionFormat), PROP_collectionFormat)
+ .addIf(nn(default_), PROP_default)
+ .addIf(nn(description), PROP_description)
+ .addIf(ne(enum_), PROP_enum)
+ .addIf(nn(example), PROP_example)
+ .addIf(nn(examples), PROP_examples)
+ .addIf(nn(exclusiveMaximum), PROP_exclusiveMaximum)
+ .addIf(nn(exclusiveMinimum), PROP_exclusiveMinimum)
+ .addIf(nn(format), PROP_format)
+ .addIf(nn(in), PROP_in)
+ .addIf(nn(items), PROP_items)
+ .addIf(nn(maxItems), PROP_maxItems)
+ .addIf(nn(maxLength), PROP_maxLength)
+ .addIf(nn(maximum), PROP_maximum)
+ .addIf(nn(minItems), PROP_minItems)
+ .addIf(nn(minLength), PROP_minLength)
+ .addIf(nn(minimum), PROP_minimum)
+ .addIf(nn(multipleOf), PROP_multipleOf)
+ .addIf(nn(name), PROP_name)
+ .addIf(nn(pattern), PROP_pattern)
+ .addIf(nn(required), PROP_required)
+ .addIf(nn(schema), PROP_schema)
+ .addIf(nn(type), PROP_type)
+ .addIf(nn(uniqueItems), PROP_uniqueItems)
.build();
// @formatter:on
return new MultiSet<>(s, super.keySet());
@@ -617,31 +644,31 @@ public class ParameterInfo extends SwaggerElement {
public ParameterInfo set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "allowEmptyValue" ->
setAllowEmptyValue(toBoolean(value));
- case "collectionFormat" ->
setCollectionFormat(s(value));
- case "default" -> setDefault(value);
- case "description" -> setDescription(s(value));
- case "enum" -> setEnum(value);
- case "example" -> setExample(value);
- case "examples" -> setExamples(toType(value,
Map.class));
- case "exclusiveMaximum" ->
setExclusiveMaximum(toBoolean(value));
- case "exclusiveMinimum" ->
setExclusiveMinimum(toBoolean(value));
- case "format" -> setFormat(s(value));
- case "in" -> setIn(s(value));
- case "items" -> setItems(toType(value, Items.class));
- case "maximum" -> setMaximum(toNumber(value));
- case "maxItems" -> setMaxItems(toInteger(value));
- case "maxLength" -> setMaxLength(toInteger(value));
- case "minimum" -> setMinimum(toNumber(value));
- case "minItems" -> setMinItems(toInteger(value));
- case "minLength" -> setMinLength(toInteger(value));
- case "multipleOf" -> setMultipleOf(toNumber(value));
- case "name" -> setName(s(value));
- case "pattern" -> setPattern(s(value));
- case "required" -> setRequired(toBoolean(value));
- case "schema" -> setSchema(toType(value,
SchemaInfo.class));
- case "type" -> setType(s(value));
- case "uniqueItems" -> setUniqueItems(toBoolean(value));
+ case PROP_allowEmptyValue ->
setAllowEmptyValue(toBoolean(value));
+ case PROP_collectionFormat ->
setCollectionFormat(s(value));
+ case PROP_default -> setDefault(value);
+ case PROP_description -> setDescription(s(value));
+ case PROP_enum -> setEnum(value);
+ case PROP_example -> setExample(value);
+ case PROP_examples -> setExamples(toType(value,
Map.class));
+ case PROP_exclusiveMaximum ->
setExclusiveMaximum(toBoolean(value));
+ case PROP_exclusiveMinimum ->
setExclusiveMinimum(toBoolean(value));
+ case PROP_format -> setFormat(s(value));
+ case PROP_in -> setIn(s(value));
+ case PROP_items -> setItems(toType(value, Items.class));
+ case PROP_maximum -> setMaximum(toNumber(value));
+ case PROP_maxItems -> setMaxItems(toInteger(value));
+ case PROP_maxLength -> setMaxLength(toInteger(value));
+ case PROP_minimum -> setMinimum(toNumber(value));
+ case PROP_minItems -> setMinItems(toInteger(value));
+ case PROP_minLength -> setMinLength(toInteger(value));
+ case PROP_multipleOf -> setMultipleOf(toNumber(value));
+ case PROP_name -> setName(s(value));
+ case PROP_pattern -> setPattern(s(value));
+ case PROP_required -> setRequired(toBoolean(value));
+ case PROP_schema -> setSchema(toType(value,
SchemaInfo.class));
+ case PROP_type -> setType(s(value));
+ case PROP_uniqueItems ->
setUniqueItems(toBoolean(value));
default -> {
super.set(property, value);
yield this;
diff --git
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/ResponseInfo.java
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/ResponseInfo.java
index 89965c2608..c8cffb008f 100644
---
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/ResponseInfo.java
+++
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/ResponseInfo.java
@@ -90,6 +90,12 @@ public class ResponseInfo extends SwaggerElement {
private static final String ARG_name = "name";
private static final String ARG_property = "property";
+ // Property name constants
+ private static final String PROP_description = "description";
+ private static final String PROP_examples = "examples";
+ private static final String PROP_headers = "headers";
+ private static final String PROP_schema = "schema";
+
private String description;
private SchemaInfo schema;
private Map<String,HeaderInfo> headers = map();
@@ -182,10 +188,10 @@ public class ResponseInfo extends SwaggerElement {
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "description" -> toType(getDescription(), type);
- case "examples" -> toType(getExamples(), type);
- case "headers" -> toType(getHeaders(), type);
- case "schema" -> toType(getSchema(), type);
+ case PROP_description -> toType(getDescription(), type);
+ case PROP_examples -> toType(getExamples(), type);
+ case PROP_headers -> toType(getHeaders(), type);
+ case PROP_schema -> toType(getSchema(), type);
default -> super.get(property, type);
};
}
@@ -245,10 +251,10 @@ public class ResponseInfo extends SwaggerElement {
public Set<String> keySet() {
// @formatter:off
var s = setb(String.class)
- .addIf(nn(description), "description")
- .addIf(ne(examples), "examples")
- .addIf(ne(headers), "headers")
- .addIf(nn(schema), "schema")
+ .addIf(nn(description), PROP_description)
+ .addIf(ne(examples), PROP_examples)
+ .addIf(ne(headers), PROP_headers)
+ .addIf(nn(schema), PROP_schema)
.build();
// @formatter:on
return new MultiSet<>(s, super.keySet());
@@ -281,10 +287,10 @@ public class ResponseInfo extends SwaggerElement {
public ResponseInfo set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "description" -> setDescription(s(value));
- case "examples" -> setExamples(toMapBuilder(value,
String.class, Object.class).sparse().build());
- case "headers" -> setHeaders(toMapBuilder(value,
String.class, HeaderInfo.class).sparse().build());
- case "schema" -> setSchema(toType(value,
SchemaInfo.class));
+ case PROP_description -> setDescription(s(value));
+ case PROP_examples -> setExamples(toMapBuilder(value,
String.class, Object.class).sparse().build());
+ case PROP_headers -> setHeaders(toMapBuilder(value,
String.class, HeaderInfo.class).sparse().build());
+ case PROP_schema -> setSchema(toType(value,
SchemaInfo.class));
default -> {
super.set(property, value);
yield this;
diff --git
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/SchemaInfo.java
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/SchemaInfo.java
index 8ca3eeda83..dbb9ed1c37 100644
---
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/SchemaInfo.java
+++
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/SchemaInfo.java
@@ -104,6 +104,39 @@ public class SchemaInfo extends SwaggerElement {
private static final String ARG_property = "property";
private static final String ARG_value = "value";
+ // Property name constants
+ private static final String PROP_additionalProperties =
"additionalProperties";
+ private static final String PROP_allOf = "allOf";
+ private static final String PROP_default = "default";
+ private static final String PROP_description = "description";
+ private static final String PROP_discriminator = "discriminator";
+ private static final String PROP_enum = "enum";
+ private static final String PROP_example = "example";
+ private static final String PROP_exclusiveMaximum = "exclusiveMaximum";
+ private static final String PROP_exclusiveMinimum = "exclusiveMinimum";
+ private static final String PROP_externalDocs = "externalDocs";
+ private static final String PROP_format = "format";
+ private static final String PROP_items = "items";
+ private static final String PROP_maxItems = "maxItems";
+ private static final String PROP_maxLength = "maxLength";
+ private static final String PROP_maxProperties = "maxProperties";
+ private static final String PROP_maximum = "maximum";
+ private static final String PROP_minItems = "minItems";
+ private static final String PROP_minLength = "minLength";
+ private static final String PROP_minProperties = "minProperties";
+ private static final String PROP_minimum = "minimum";
+ private static final String PROP_multipleOf = "multipleOf";
+ private static final String PROP_pattern = "pattern";
+ private static final String PROP_properties = "properties";
+ private static final String PROP_readOnly = "readOnly";
+ private static final String PROP_required = "required";
+ private static final String PROP_requiredProperties =
"requiredProperties";
+ private static final String PROP_title = "title";
+ private static final String PROP_type = "type";
+ private static final String PROP_uniqueItems = "uniqueItems";
+ private static final String PROP_xml = "xml";
+ private static final String PROP_ref = "$ref";
+
private String format;
private String title;
private String description;
@@ -317,37 +350,37 @@ public class SchemaInfo extends SwaggerElement {
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "additionalProperties" ->
toType(getAdditionalProperties(), type);
- case "allOf" -> toType(getAllOf(), type);
- case "default" -> toType(getDefault(), type);
- case "description" -> toType(getDescription(), type);
- case "discriminator" -> toType(getDiscriminator(),
type);
- case "enum" -> toType(getEnum(), type);
- case "example" -> toType(getExample(), type);
- case "exclusiveMaximum" ->
toType(getExclusiveMaximum(), type);
- case "exclusiveMinimum" ->
toType(getExclusiveMinimum(), type);
- case "externalDocs" -> toType(getExternalDocs(), type);
- case "format" -> toType(getFormat(), type);
- case "items" -> toType(getItems(), type);
- case "maximum" -> toType(getMaximum(), type);
- case "maxItems" -> toType(getMaxItems(), type);
- case "maxLength" -> toType(getMaxLength(), type);
- case "maxProperties" -> toType(getMaxProperties(),
type);
- case "minimum" -> toType(getMinimum(), type);
- case "minItems" -> toType(getMinItems(), type);
- case "minLength" -> toType(getMinLength(), type);
- case "minProperties" -> toType(getMinProperties(),
type);
- case "multipleOf" -> toType(getMultipleOf(), type);
- case "pattern" -> toType(getPattern(), type);
- case "properties" -> toType(getProperties(), type);
- case "readOnly" -> toType(getReadOnly(), type);
- case "$ref" -> toType(getRef(), type);
- case "required" -> toType(getRequired(), type);
- case "requiredProperties" ->
toType(getRequiredProperties(), type);
- case "title" -> toType(getTitle(), type);
- case "type" -> toType(getType(), type);
- case "uniqueItems" -> toType(getUniqueItems(), type);
- case "xml" -> toType(getXml(), type);
+ case PROP_additionalProperties ->
toType(getAdditionalProperties(), type);
+ case PROP_allOf -> toType(getAllOf(), type);
+ case PROP_default -> toType(getDefault(), type);
+ case PROP_description -> toType(getDescription(), type);
+ case PROP_discriminator -> toType(getDiscriminator(),
type);
+ case PROP_enum -> toType(getEnum(), type);
+ case PROP_example -> toType(getExample(), type);
+ case PROP_exclusiveMaximum ->
toType(getExclusiveMaximum(), type);
+ case PROP_exclusiveMinimum ->
toType(getExclusiveMinimum(), type);
+ case PROP_externalDocs -> toType(getExternalDocs(),
type);
+ case PROP_format -> toType(getFormat(), type);
+ case PROP_items -> toType(getItems(), type);
+ case PROP_maximum -> toType(getMaximum(), type);
+ case PROP_maxItems -> toType(getMaxItems(), type);
+ case PROP_maxLength -> toType(getMaxLength(), type);
+ case PROP_maxProperties -> toType(getMaxProperties(),
type);
+ case PROP_minimum -> toType(getMinimum(), type);
+ case PROP_minItems -> toType(getMinItems(), type);
+ case PROP_minLength -> toType(getMinLength(), type);
+ case PROP_minProperties -> toType(getMinProperties(),
type);
+ case PROP_multipleOf -> toType(getMultipleOf(), type);
+ case PROP_pattern -> toType(getPattern(), type);
+ case PROP_properties -> toType(getProperties(), type);
+ case PROP_readOnly -> toType(getReadOnly(), type);
+ case PROP_ref -> toType(getRef(), type);
+ case PROP_required -> toType(getRequired(), type);
+ case PROP_requiredProperties ->
toType(getRequiredProperties(), type);
+ case PROP_title -> toType(getTitle(), type);
+ case PROP_type -> toType(getType(), type);
+ case PROP_uniqueItems -> toType(getUniqueItems(), type);
+ case PROP_xml -> toType(getXml(), type);
default -> super.get(property, type);
};
}
@@ -580,37 +613,37 @@ public class SchemaInfo extends SwaggerElement {
public Set<String> keySet() {
// @formatter:off
var s = setb(String.class)
- .addIf(nn(ref), "$ref")
- .addIf(nn(additionalProperties), "additionalProperties")
- .addIf(ne(allOf), "allOf")
- .addIf(nn(default_), "default")
- .addIf(nn(description), "description")
- .addIf(nn(discriminator), "discriminator")
- .addIf(ne(enum_), "enum")
- .addIf(nn(example), "example")
- .addIf(nn(exclusiveMaximum), "exclusiveMaximum")
- .addIf(nn(exclusiveMinimum), "exclusiveMinimum")
- .addIf(nn(externalDocs), "externalDocs")
- .addIf(nn(format), "format")
- .addIf(nn(items), "items")
- .addIf(nn(maxItems), "maxItems")
- .addIf(nn(maxLength), "maxLength")
- .addIf(nn(maxProperties), "maxProperties")
- .addIf(nn(maximum), "maximum")
- .addIf(nn(minItems), "minItems")
- .addIf(nn(minLength), "minLength")
- .addIf(nn(minProperties), "minProperties")
- .addIf(nn(minimum), "minimum")
- .addIf(nn(multipleOf), "multipleOf")
- .addIf(nn(pattern), "pattern")
- .addIf(ne(properties), "properties")
- .addIf(nn(readOnly), "readOnly")
- .addIf(nn(required), "required")
- .addIf(ne(requiredProperties), "requiredProperties")
- .addIf(nn(title), "title")
- .addIf(nn(type), "type")
- .addIf(nn(uniqueItems), "uniqueItems")
- .addIf(nn(xml), "xml")
+ .addIf(nn(ref), PROP_ref)
+ .addIf(nn(additionalProperties),
PROP_additionalProperties)
+ .addIf(ne(allOf), PROP_allOf)
+ .addIf(nn(default_), PROP_default)
+ .addIf(nn(description), PROP_description)
+ .addIf(nn(discriminator), PROP_discriminator)
+ .addIf(ne(enum_), PROP_enum)
+ .addIf(nn(example), PROP_example)
+ .addIf(nn(exclusiveMaximum), PROP_exclusiveMaximum)
+ .addIf(nn(exclusiveMinimum), PROP_exclusiveMinimum)
+ .addIf(nn(externalDocs), PROP_externalDocs)
+ .addIf(nn(format), PROP_format)
+ .addIf(nn(items), PROP_items)
+ .addIf(nn(maxItems), PROP_maxItems)
+ .addIf(nn(maxLength), PROP_maxLength)
+ .addIf(nn(maxProperties), PROP_maxProperties)
+ .addIf(nn(maximum), PROP_maximum)
+ .addIf(nn(minItems), PROP_minItems)
+ .addIf(nn(minLength), PROP_minLength)
+ .addIf(nn(minProperties), PROP_minProperties)
+ .addIf(nn(minimum), PROP_minimum)
+ .addIf(nn(multipleOf), PROP_multipleOf)
+ .addIf(nn(pattern), PROP_pattern)
+ .addIf(ne(properties), PROP_properties)
+ .addIf(nn(readOnly), PROP_readOnly)
+ .addIf(nn(required), PROP_required)
+ .addIf(ne(requiredProperties), PROP_requiredProperties)
+ .addIf(nn(title), PROP_title)
+ .addIf(nn(type), PROP_type)
+ .addIf(nn(uniqueItems), PROP_uniqueItems)
+ .addIf(nn(xml), PROP_xml)
.build();
// @formatter:on
return new MultiSet<>(s, super.keySet());
@@ -657,37 +690,37 @@ public class SchemaInfo extends SwaggerElement {
public SchemaInfo set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "additionalProperties" ->
setAdditionalProperties(toType(value, SchemaInfo.class));
- case "allOf" -> setAllOf(toSetBuilder(value,
SchemaInfo.class).sparse().build());
- case "default" -> setDefault(value);
- case "description" -> setDescription(s(value));
- case "discriminator" -> setDiscriminator(s(value));
- case "enum" -> setEnum(value);
- case "example" -> setExample(value);
- case "exclusiveMaximum" ->
setExclusiveMaximum(toBoolean(value));
- case "exclusiveMinimum" ->
setExclusiveMinimum(toBoolean(value));
- case "externalDocs" -> setExternalDocs(toType(value,
ExternalDocumentation.class));
- case "format" -> setFormat(s(value));
- case "items" -> setItems(toType(value, Items.class));
- case "maximum" -> setMaximum(toNumber(value));
- case "maxItems" -> setMaxItems(toInteger(value));
- case "maxLength" -> setMaxLength(toInteger(value));
- case "maxProperties" ->
setMaxProperties(toInteger(value));
- case "minimum" -> setMinimum(toNumber(value));
- case "minItems" -> setMinItems(toInteger(value));
- case "minLength" -> setMinLength(toInteger(value));
- case "minProperties" ->
setMinProperties(toInteger(value));
- case "multipleOf" -> setMultipleOf(toNumber(value));
- case "pattern" -> setPattern(s(value));
- case "properties" -> setProperties(toMapBuilder(value,
String.class, SchemaInfo.class).sparse().build());
- case "readOnly" -> setReadOnly(toBoolean(value));
- case "$ref" -> setRef(s(value));
- case "required" -> setRequired(toBoolean(value));
- case "requiredProperties" ->
setRequiredProperties(listb(String.class).addAny(value).sparse().build());
- case "title" -> setTitle(s(value));
- case "type" -> setType(s(value));
- case "uniqueItems" -> setUniqueItems(toBoolean(value));
- case "xml" -> setXml(toType(value, Xml.class));
+ case PROP_additionalProperties ->
setAdditionalProperties(toType(value, SchemaInfo.class));
+ case PROP_allOf -> setAllOf(toSetBuilder(value,
SchemaInfo.class).sparse().build());
+ case PROP_default -> setDefault(value);
+ case PROP_description -> setDescription(s(value));
+ case PROP_discriminator -> setDiscriminator(s(value));
+ case PROP_enum -> setEnum(value);
+ case PROP_example -> setExample(value);
+ case PROP_exclusiveMaximum ->
setExclusiveMaximum(toBoolean(value));
+ case PROP_exclusiveMinimum ->
setExclusiveMinimum(toBoolean(value));
+ case PROP_externalDocs -> setExternalDocs(toType(value,
ExternalDocumentation.class));
+ case PROP_format -> setFormat(s(value));
+ case PROP_items -> setItems(toType(value, Items.class));
+ case PROP_maximum -> setMaximum(toNumber(value));
+ case PROP_maxItems -> setMaxItems(toInteger(value));
+ case PROP_maxLength -> setMaxLength(toInteger(value));
+ case PROP_maxProperties ->
setMaxProperties(toInteger(value));
+ case PROP_minimum -> setMinimum(toNumber(value));
+ case PROP_minItems -> setMinItems(toInteger(value));
+ case PROP_minLength -> setMinLength(toInteger(value));
+ case PROP_minProperties ->
setMinProperties(toInteger(value));
+ case PROP_multipleOf -> setMultipleOf(toNumber(value));
+ case PROP_pattern -> setPattern(s(value));
+ case PROP_properties ->
setProperties(toMapBuilder(value, String.class,
SchemaInfo.class).sparse().build());
+ case PROP_readOnly -> setReadOnly(toBoolean(value));
+ case PROP_ref -> setRef(s(value));
+ case PROP_required -> setRequired(toBoolean(value));
+ case PROP_requiredProperties ->
setRequiredProperties(listb(String.class).addAny(value).sparse().build());
+ case PROP_title -> setTitle(s(value));
+ case PROP_type -> setType(s(value));
+ case PROP_uniqueItems ->
setUniqueItems(toBoolean(value));
+ case PROP_xml -> setXml(toType(value, Xml.class));
default -> {
super.set(property, value);
yield this;
diff --git
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/SecurityScheme.java
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/SecurityScheme.java
index 46d1af03fa..09172fbb59 100644
---
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/SecurityScheme.java
+++
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/SecurityScheme.java
@@ -89,6 +89,16 @@ public class SecurityScheme extends SwaggerElement {
private static final String ARG_property = "property";
private static final String ARG_value = "value";
+ // Property name constants
+ private static final String PROP_authorizationUrl = "authorizationUrl";
+ private static final String PROP_description = "description";
+ private static final String PROP_scopes = "scopes";
+ private static final String PROP_flow = "flow";
+ private static final String PROP_in = "in";
+ private static final String PROP_name = "name";
+ private static final String PROP_tokenUrl = "tokenUrl";
+ private static final String PROP_type = "type";
+
private static final String[] VALID_TYPES = { "basic", "apiKey",
"oauth2" };
private String type;
@@ -154,14 +164,14 @@ public class SecurityScheme extends SwaggerElement {
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "authorizationUrl" ->
toType(getAuthorizationUrl(), type);
- case "description" -> toType(getDescription(), type);
- case "flow" -> toType(getFlow(), type);
- case "in" -> toType(getIn(), type);
- case "name" -> toType(getName(), type);
- case "scopes" -> toType(getScopes(), type);
- case "tokenUrl" -> toType(getTokenUrl(), type);
- case "type" -> toType(getType(), type);
+ case PROP_authorizationUrl ->
toType(getAuthorizationUrl(), type);
+ case PROP_description -> toType(getDescription(), type);
+ case PROP_flow -> toType(getFlow(), type);
+ case PROP_in -> toType(getIn(), type);
+ case PROP_name -> toType(getName(), type);
+ case PROP_scopes -> toType(getScopes(), type);
+ case PROP_tokenUrl -> toType(getTokenUrl(), type);
+ case PROP_type -> toType(getType(), type);
default -> super.get(property, type);
};
}
@@ -250,14 +260,14 @@ public class SecurityScheme extends SwaggerElement {
public Set<String> keySet() {
// @formatter:off
var s = setb(String.class)
- .addIf(nn(authorizationUrl), "authorizationUrl")
- .addIf(nn(description), "description")
- .addIf(nn(flow), "flow")
- .addIf(nn(in), "in")
- .addIf(nn(name), "name")
- .addIf(ne(scopes), "scopes")
- .addIf(nn(tokenUrl), "tokenUrl")
- .addIf(nn(type), "type")
+ .addIf(nn(authorizationUrl), PROP_authorizationUrl)
+ .addIf(nn(description), PROP_description)
+ .addIf(nn(flow), PROP_flow)
+ .addIf(nn(in), PROP_in)
+ .addIf(nn(name), PROP_name)
+ .addIf(ne(scopes), PROP_scopes)
+ .addIf(nn(tokenUrl), PROP_tokenUrl)
+ .addIf(nn(type), PROP_type)
.build();
// @formatter:on
return new MultiSet<>(s, super.keySet());
@@ -267,14 +277,14 @@ public class SecurityScheme extends SwaggerElement {
public SecurityScheme set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "authorizationUrl" ->
setAuthorizationUrl(s(value));
- case "description" -> setDescription(s(value));
- case "flow" -> setFlow(s(value));
- case "in" -> setIn(s(value));
- case "name" -> setName(s(value));
- case "scopes" -> setScopes(toMapBuilder(value,
String.class, String.class).sparse().build());
- case "tokenUrl" -> setTokenUrl(s(value));
- case "type" -> setType(s(value));
+ case PROP_authorizationUrl ->
setAuthorizationUrl(s(value));
+ case PROP_description -> setDescription(s(value));
+ case PROP_flow -> setFlow(s(value));
+ case PROP_in -> setIn(s(value));
+ case PROP_name -> setName(s(value));
+ case PROP_scopes -> setScopes(toMapBuilder(value,
String.class, String.class).sparse().build());
+ case PROP_tokenUrl -> setTokenUrl(s(value));
+ case PROP_type -> setType(s(value));
default -> {
super.set(property, value);
yield this;
diff --git
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/Tag.java
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/Tag.java
index ecddd0273b..833c96d099 100644
---
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/Tag.java
+++
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/Tag.java
@@ -75,6 +75,11 @@ public class Tag extends SwaggerElement {
// Argument name constants for assertArgNotNull
private static final String ARG_property = "property";
+ // Property name constants
+ private static final String PROP_description = "description";
+ private static final String PROP_externalDocs = "externalDocs";
+ private static final String PROP_name = "name";
+
private String name;
private String description;
private ExternalDocumentation externalDocs;
@@ -110,9 +115,9 @@ public class Tag extends SwaggerElement {
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "description" -> toType(getDescription(), type);
- case "externalDocs" -> toType(getExternalDocs(), type);
- case "name" -> toType(getName(), type);
+ case PROP_description -> toType(getDescription(), type);
+ case PROP_externalDocs -> toType(getExternalDocs(),
type);
+ case PROP_name -> toType(getName(), type);
default -> super.get(property, type);
};
}
@@ -151,9 +156,9 @@ public class Tag extends SwaggerElement {
public Set<String> keySet() {
// @formatter:off
var s = setb(String.class)
- .addIf(nn(description), "description")
- .addIf(nn(externalDocs), "externalDocs")
- .addIf(nn(name), "name")
+ .addIf(nn(description), PROP_description)
+ .addIf(nn(externalDocs), PROP_externalDocs)
+ .addIf(nn(name), PROP_name)
.build();
// @formatter:on
return new MultiSet<>(s, super.keySet());
@@ -163,9 +168,9 @@ public class Tag extends SwaggerElement {
public Tag set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "description" -> setDescription(s(value));
- case "externalDocs" -> setExternalDocs(toType(value,
ExternalDocumentation.class));
- case "name" -> setName(s(value));
+ case PROP_description -> setDescription(s(value));
+ case PROP_externalDocs -> setExternalDocs(toType(value,
ExternalDocumentation.class));
+ case PROP_name -> setName(s(value));
default -> {
super.set(property, value);
yield this;
diff --git
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/Xml.java
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/Xml.java
index b100cb4d22..d44a093afd 100644
---
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/Xml.java
+++
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/Xml.java
@@ -77,6 +77,13 @@ public class Xml extends SwaggerElement {
// Argument name constants for assertArgNotNull
private static final String ARG_property = "property";
+ // Property name constants
+ private static final String PROP_attribute = "attribute";
+ private static final String PROP_namespace = "namespace";
+ private static final String PROP_prefix = "prefix";
+ private static final String PROP_name = "name";
+ private static final String PROP_wrapped = "wrapped";
+
private String name;
private String namespace;
private String prefix;
@@ -116,11 +123,11 @@ public class Xml extends SwaggerElement {
public <T> T get(String property, Class<T> type) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "attribute" -> toType(getAttribute(), type);
- case "name" -> toType(getName(), type);
- case "namespace" -> toType(getNamespace(), type);
- case "prefix" -> toType(getPrefix(), type);
- case "wrapped" -> toType(getWrapped(), type);
+ case PROP_attribute -> toType(getAttribute(), type);
+ case PROP_name -> toType(getName(), type);
+ case PROP_namespace -> toType(getNamespace(), type);
+ case PROP_prefix -> toType(getPrefix(), type);
+ case PROP_wrapped -> toType(getWrapped(), type);
default -> super.get(property, type);
};
}
@@ -183,11 +190,11 @@ public class Xml extends SwaggerElement {
public Set<String> keySet() {
// @formatter:off
var s = setb(String.class)
- .addIf(nn(attribute), "attribute")
- .addIf(nn(name), "name")
- .addIf(nn(namespace), "namespace")
- .addIf(nn(prefix), "prefix")
- .addIf(nn(wrapped), "wrapped")
+ .addIf(nn(attribute), PROP_attribute)
+ .addIf(nn(name), PROP_name)
+ .addIf(nn(namespace), PROP_namespace)
+ .addIf(nn(prefix), PROP_prefix)
+ .addIf(nn(wrapped), PROP_wrapped)
.build();
// @formatter:on
return new MultiSet<>(s, super.keySet());
@@ -197,11 +204,11 @@ public class Xml extends SwaggerElement {
public Xml set(String property, Object value) {
assertArgNotNull(ARG_property, property);
return switch (property) {
- case "attribute" -> setAttribute(toBoolean(value));
- case "name" -> setName(s(value));
- case "namespace" -> setNamespace(s(value));
- case "prefix" -> setPrefix(s(value));
- case "wrapped" -> setWrapped(toBoolean(value));
+ case PROP_attribute -> setAttribute(toBoolean(value));
+ case PROP_name -> setName(s(value));
+ case PROP_namespace -> setNamespace(s(value));
+ case PROP_prefix -> setPrefix(s(value));
+ case PROP_wrapped -> setWrapped(toBoolean(value));
default -> {
super.set(property, value);
yield this;
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/collections/CacheMode.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/collections/CacheMode.java
index 0dcb7333b4..e9c099ad99 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/collections/CacheMode.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/collections/CacheMode.java
@@ -96,6 +96,11 @@ public enum CacheMode {
*/
FULL;
+ // Constant values for parsing
+ private static final String CONST_NONE = "NONE";
+ private static final String CONST_WEAK = "WEAK";
+ private static final String CONST_FULL = "FULL";
+
/**
* Parses a string value into a {@link CacheMode}.
*
@@ -118,9 +123,9 @@ public enum CacheMode {
if (value == null)
return FULL;
return switch (value.toUpperCase()) {
- case "NONE" -> NONE;
- case "WEAK" -> WEAK;
- case "FULL" -> FULL;
+ case CONST_NONE -> NONE;
+ case CONST_WEAK -> WEAK;
+ case CONST_FULL -> FULL;
default -> FULL;
};
}
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/logging/LogRecord.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/logging/LogRecord.java
index 161976c2f1..0ccd2bc5bc 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/logging/LogRecord.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/logging/LogRecord.java
@@ -51,6 +51,21 @@ import org.apache.juneau.commons.utils.*;
public class LogRecord extends java.util.logging.LogRecord {
private static final long serialVersionUID = 1L;
+
+ // Key constants for format placeholders
+ private static final String KEY_date = "date";
+ private static final String KEY_source = "source";
+ private static final String KEY_logger = "logger";
+ private static final String KEY_level = "level";
+ private static final String KEY_msg = "msg";
+ private static final String KEY_thrown = "thrown";
+ private static final String KEY_timestamp = "timestamp";
+ private static final String KEY_class = "class";
+ private static final String KEY_method = "method";
+ private static final String KEY_thread = "thread";
+ private static final String KEY_threadid = "threadid";
+ private static final String KEY_exception = "exception";
+
private transient Supplier<Optional<StackTraceElement>> source =
mem(()->findSource());
/**
@@ -234,17 +249,17 @@ public class LogRecord extends
java.util.logging.LogRecord {
Supplier<String> sourceName = () -> getSourceClassName() + ' '
+ getSourceMethodName();
Function<String, Object> resolver = key -> switch (key) {
- case "date" -> "%1$s";
- case "source" -> sourceName.get(); // Override default
behavior since logging class doesn't handle classes outside of
java.util.logging.
- case "logger" -> "%3$s";
- case "level" -> "%4$s";
- case "msg" -> "%5$s";
- case "thrown" -> "%6$s";
- case "timestamp" -> new
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(date);
- case "class" -> getSourceClassName();
- case "method" -> getSourceMethodName();
- case "thread", "threadid" -> s(getThreadID());
- case "exception" -> opt(getThrown()).map(x ->
x.getMessage()).orElse("");
+ case KEY_date -> "%1$s";
+ case KEY_source -> sourceName.get(); // Override
default behavior since logging class doesn't handle classes outside of
java.util.logging.
+ case KEY_logger -> "%3$s";
+ case KEY_level -> "%4$s";
+ case KEY_msg -> "%5$s";
+ case KEY_thrown -> "%6$s";
+ case KEY_timestamp -> new
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(date);
+ case KEY_class -> getSourceClassName();
+ case KEY_method -> getSourceMethodName();
+ case KEY_thread, KEY_threadid -> s(getThreadID());
+ case KEY_exception -> opt(getThrown()).map(x ->
x.getMessage()).orElse("");
default -> "";
};
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSchema.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSchema.java
index 3b3f6d2496..bf2434a147 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSchema.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSchema.java
@@ -88,6 +88,40 @@ public class HttpPartSchema {
private static final AnnotationProvider AP =
AnnotationProvider.INSTANCE;
+ // Property name constants
+ private static final String PROP_additionalProperties =
"additionalProperties";
+ private static final String PROP_collectionFormat = "collectionFormat";
+ private static final String PROP_exclusiveMaximum = "exclusiveMaximum";
+ private static final String PROP_exclusiveMinimum = "exclusiveMinimum";
+ private static final String PROP_items = "items";
+ private static final String PROP_maximum = "maximum";
+ private static final String PROP_maxItems = "maxItems";
+ private static final String PROP_maxLength = "maxLength";
+ private static final String PROP_maxProperties = "maxProperties";
+ private static final String PROP_minimum = "minimum";
+ private static final String PROP_minItems = "minItems";
+ private static final String PROP_minLength = "minLength";
+ private static final String PROP_minProperties = "minProperties";
+ private static final String PROP_multipleOf = "multipleOf";
+ private static final String PROP_pattern = "pattern";
+ private static final String PROP_properties = "properties";
+
+ // Jakarta validation annotation class name constants
+ private static final String CLASSNAME_NotNull = "NotNull";
+ private static final String CLASSNAME_Size = "Size";
+ private static final String CLASSNAME_Min = "Min";
+ private static final String CLASSNAME_Max = "Max";
+ private static final String CLASSNAME_Pattern = "Pattern";
+ private static final String CLASSNAME_Email = "Email";
+ private static final String CLASSNAME_Positive = "Positive";
+ private static final String CLASSNAME_PositiveOrZero = "PositiveOrZero";
+ private static final String CLASSNAME_Negative = "Negative";
+ private static final String CLASSNAME_NegativeOrZero = "NegativeOrZero";
+ private static final String CLASSNAME_NotEmpty = "NotEmpty";
+ private static final String CLASSNAME_NotBlank = "NotBlank";
+ private static final String CLASSNAME_DecimalMin = "DecimalMin";
+ private static final String CLASSNAME_DecimalMax = "DecimalMax";
+
/**
* Builder class.
*/
@@ -2656,27 +2690,27 @@ public class HttpPartSchema {
default_(m.getString("default"));
enum_(HttpPartSchema.toSet(m.getString("enum")));
allowEmptyValue(m.getBoolean("allowEmptyValue"));
-
exclusiveMaximum(m.getBoolean("exclusiveMaximum"));
-
exclusiveMinimum(m.getBoolean("exclusiveMinimum"));
+
exclusiveMaximum(m.getBoolean(PROP_exclusiveMaximum));
+
exclusiveMinimum(m.getBoolean(PROP_exclusiveMinimum));
required(m.getBoolean("required"));
uniqueItems(m.getBoolean("uniqueItems"));
-
collectionFormat(m.getString("collectionFormat"));
+
collectionFormat(m.getString(PROP_collectionFormat));
type(m.getString("type"));
format(m.getString("format"));
- pattern(m.getString("pattern"));
- maximum(m.get("maximum", Number.class));
- minimum(m.get("minimum", Number.class));
- multipleOf(m.get("multipleOf", Number.class));
- maxItems(m.get("maxItems", Long.class));
- maxLength(m.get("maxLength", Long.class));
- maxProperties(m.get("maxProperties",
Long.class));
- minItems(m.get("minItems", Long.class));
- minLength(m.get("minLength", Long.class));
- minProperties(m.get("minProperties",
Long.class));
-
- items(m.getMap("items"));
- properties(m.getMap("properties"));
-
additionalProperties(m.getMap("additionalProperties"));
+ pattern(m.getString(PROP_pattern));
+ maximum(m.get(PROP_maximum, Number.class));
+ minimum(m.get(PROP_minimum, Number.class));
+ multipleOf(m.get(PROP_multipleOf,
Number.class));
+ maxItems(m.get(PROP_maxItems, Long.class));
+ maxLength(m.get(PROP_maxLength, Long.class));
+ maxProperties(m.get(PROP_maxProperties,
Long.class));
+ minItems(m.get(PROP_minItems, Long.class));
+ minLength(m.get(PROP_minLength, Long.class));
+ minProperties(m.get(PROP_minProperties,
Long.class));
+
+ items(m.getMap(PROP_items));
+ properties(m.getMap(PROP_properties));
+
additionalProperties(m.getMap(PROP_additionalProperties));
apply(m.getMap("schema", null));
}
@@ -2867,10 +2901,10 @@ public class HttpPartSchema {
try {
switch (simpleName) {
- case "NotNull":
+ case CLASSNAME_NotNull:
required(true);
break;
- case "Size":
+ case CLASSNAME_Size:
Integer min =
getAnnotationValue(a, "min", Integer.class);
Integer max =
getAnnotationValue(a, "max", Integer.class);
if (nn(min) && min > 0) {
@@ -2882,49 +2916,49 @@ public class HttpPartSchema {
maxItems(max.longValue());
}
break;
- case "Min":
+ case CLASSNAME_Min:
Long minValue =
getAnnotationValue(a, "value", Long.class);
if (nn(minValue))
minimum(minValue);
break;
- case "Max":
+ case CLASSNAME_Max:
Long maxValue =
getAnnotationValue(a, "value", Long.class);
if (nn(maxValue))
maximum(maxValue);
break;
- case "Pattern":
+ case CLASSNAME_Pattern:
String regexp =
getAnnotationValue(a, "regexp", String.class);
if (nn(regexp))
pattern(regexp);
break;
- case "Email":
+ case CLASSNAME_Email:
format("email");
break;
- case "Positive":
+ case CLASSNAME_Positive:
minimum(0);
exclusiveMinimum(true);
break;
- case "PositiveOrZero":
+ case CLASSNAME_PositiveOrZero:
minimum(0);
break;
- case "Negative":
+ case CLASSNAME_Negative:
maximum(0);
exclusiveMaximum(true);
break;
- case "NegativeOrZero":
+ case CLASSNAME_NegativeOrZero:
maximum(0);
break;
- case "NotEmpty":
+ case CLASSNAME_NotEmpty:
required(true);
minLength(1L);
minItems(1L);
break;
- case "NotBlank":
+ case CLASSNAME_NotBlank:
required(true);
minLength(1L);
pattern(".*\\S.*"); // Contains
at least one non-whitespace character
break;
- case "DecimalMin":
+ case CLASSNAME_DecimalMin:
String minVal =
getAnnotationValue(a, "value", String.class);
Boolean minInclusive =
getAnnotationValue(a, "inclusive", Boolean.class);
if (nn(minVal)) {
@@ -2933,7 +2967,7 @@ public class HttpPartSchema {
exclusiveMinimum(true);
}
break;
- case "DecimalMax":
+ case CLASSNAME_DecimalMax:
String maxVal =
getAnnotationValue(a, "value", String.class);
Boolean maxInclusive =
getAnnotationValue(a, "inclusive", Boolean.class);
if (nn(maxVal)) {
diff --git
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponseContent.java
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponseContent.java
index 1af629f889..e64e1b9d56 100644
---
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponseContent.java
+++
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponseContent.java
@@ -56,6 +56,8 @@ import org.apache.juneau.rest.client.assertion.*;
@SuppressWarnings({"resource", "java:S4144"})
public class ResponseContent implements HttpEntity {
+ private static final String HEADER_ContentType = "Content-Type";
+
private static final HttpEntity NULL_ENTITY = new HttpEntity() {
@Override
@@ -240,7 +242,7 @@ public class ResponseContent implements HttpEntity {
if (result.isPresent())
return result.get();
- var ct =
firstNonEmpty(response.getHeader("Content-Type").orElse("text/plain"));
+ var ct =
firstNonEmpty(response.getHeader(HEADER_ContentType).orElse("text/plain"));
if (parser == null)
parser = client.getMatchingParser(ct);
@@ -283,7 +285,7 @@ public class ResponseContent implements HttpEntity {
if (type.hasInputStreamMutater())
return
type.getInputStreamMutater().mutate(asInputStream());
- ct =
response.getStringHeader("Content-Type").orElse(null);
+ ct =
response.getStringHeader(HEADER_ContentType).orElse(null);
if (ct == null && client.hasParsers())
throw new ParseException("Content-Type not
specified in response header. Cannot find appropriate parser.");
@@ -1047,7 +1049,7 @@ public class ResponseContent implements HttpEntity {
* @return The <c>Content-Type</c> header for this entity, or
<jk>null</jk> if the content type is unknown.
*/
@Override /* Overridden from HttpEntity */
- public ResponseHeader getContentType() { return new
ResponseHeader("Content-Type", request, response, entity.getContentType()); }
+ public ResponseHeader getContentType() { return new
ResponseHeader(HEADER_ContentType, request, response, entity.getContentType());
}
/**
* Tells about chunked encoding for this entity.
diff --git
a/juneau-rest/juneau-rest-mock/src/main/java/org/apache/juneau/rest/mock/MockServletResponse.java
b/juneau-rest/juneau-rest-mock/src/main/java/org/apache/juneau/rest/mock/MockServletResponse.java
index cea1602909..ae92d65fc4 100644
---
a/juneau-rest/juneau-rest-mock/src/main/java/org/apache/juneau/rest/mock/MockServletResponse.java
+++
b/juneau-rest/juneau-rest-mock/src/main/java/org/apache/juneau/rest/mock/MockServletResponse.java
@@ -40,6 +40,8 @@ import jakarta.servlet.http.*;
@SuppressWarnings("java:S4144")
public class MockServletResponse implements HttpServletResponse {
+ private static final String HEADER_ContentType = "Content-Type";
+
/**
* Creates a new servlet response.
*
@@ -108,7 +110,7 @@ public class MockServletResponse implements
HttpServletResponse {
public String getCharacterEncoding() { return characterEncoding; }
@Override /* Overridden from HttpServletResponse */
- public String getContentType() { return getHeader("Content-Type"); }
+ public String getContentType() { return getHeader(HEADER_ContentType); }
@Override /* Overridden from HttpServletResponse */
public String getHeader(String name) {
@@ -213,7 +215,7 @@ public class MockServletResponse implements
HttpServletResponse {
@Override /* Overridden from HttpServletResponse */
public void setContentType(String type) {
- setHeader("Content-Type", type);
+ setHeader(HEADER_ContentType, type);
updateContentTypeHeader();
}
@@ -260,7 +262,7 @@ public class MockServletResponse implements
HttpServletResponse {
contentType =
contentType.replaceAll("\\;\\s*charset=.*", "");
if (! "UTF-8".equalsIgnoreCase(charset))
contentType = contentType + ";charset=" +
charset;
- header("Content-Type", contentType);
+ header(HEADER_ContentType, contentType);
}
}
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
index fe97b6b6d1..d45a268aa0 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
@@ -134,6 +134,11 @@ public class RestContext extends Context {
private static final String ARG_type = "type";
private static final String ARG_restContext = "restContext";
+ // Property name constants
+ private static final String PROP_defaultRequestAttributes =
"defaultRequestAttributes";
+ private static final String PROP_defaultRequestHeaders =
"defaultRequestHeaders";
+ private static final String PROP_defaultResponseHeaders =
"defaultResponseHeaders";
+
/**
* Builder class.
*/
@@ -190,9 +195,9 @@ public class RestContext extends Context {
);
private static final Set<String> DELAYED_INJECTION_NAMES = set(
- "defaultRequestAttributes",
- "defaultRequestHeaders",
- "defaultResponseHeaders",
+ PROP_defaultRequestAttributes,
+ PROP_defaultRequestHeaders,
+ PROP_defaultResponseHeaders,
"destroyMethods",
"endCallMethods",
"postCallMethods",
@@ -4011,10 +4016,10 @@ public class RestContext extends Context {
// Default value.
var v = Value.of(NamedAttributeMap.create());
- beanStore.getBean(NamedAttributeMap.class,
"defaultRequestAttributes").ifPresent(v::set);
+ beanStore.getBean(NamedAttributeMap.class,
PROP_defaultRequestAttributes).ifPresent(v::set);
// Replace with bean from:
@RestInject(name="defaultRequestAttributes") public [static] NamedAttributeMap
xxx(<args>)
- new BeanCreateMethodFinder<>(NamedAttributeMap.class,
resource.get(), beanStore).addBean(NamedAttributeMap.class, v.get()).find(x ->
isRestInjectMethod(x, "defaultRequestAttributes")).run(v::set);
+ new BeanCreateMethodFinder<>(NamedAttributeMap.class,
resource.get(), beanStore).addBean(NamedAttributeMap.class, v.get()).find(x ->
isRestInjectMethod(x, PROP_defaultRequestAttributes)).run(v::set);
return v.get();
}
@@ -4034,10 +4039,10 @@ public class RestContext extends Context {
var v = Value.of(HeaderList.create());
// Replace with bean from bean store.
- beanStore.getBean(HeaderList.class,
"defaultRequestHeaders").ifPresent(v::set);
+ beanStore.getBean(HeaderList.class,
PROP_defaultRequestHeaders).ifPresent(v::set);
// Replace with bean from:
@RestInject(name="defaultRequestHeaders") public [static] HeaderList xxx(<args>)
- new BeanCreateMethodFinder<>(HeaderList.class,
resource.get(), beanStore).addBean(HeaderList.class, v.get()).find(x ->
isRestInjectMethod(x, "defaultRequestHeaders")).run(v::set);
+ new BeanCreateMethodFinder<>(HeaderList.class,
resource.get(), beanStore).addBean(HeaderList.class, v.get()).find(x ->
isRestInjectMethod(x, PROP_defaultRequestHeaders)).run(v::set);
return v.get();
}
@@ -4057,10 +4062,10 @@ public class RestContext extends Context {
var v = Value.of(HeaderList.create());
// Replace with bean from bean store.
- beanStore.getBean(HeaderList.class,
"defaultResponseHeaders").ifPresent(v::set);
+ beanStore.getBean(HeaderList.class,
PROP_defaultResponseHeaders).ifPresent(v::set);
// Replace with bean from:
@RestInject(name="defaultResponseHeaders") public [static] HeaderList
xxx(<args>)
- new BeanCreateMethodFinder<>(HeaderList.class,
resource.get(), beanStore).addBean(HeaderList.class, v.get()).find(x ->
isRestInjectMethod(x, "defaultResponseHeaders")).run(v::set);
+ new BeanCreateMethodFinder<>(HeaderList.class,
resource.get(), beanStore).addBean(HeaderList.class, v.get()).find(x ->
isRestInjectMethod(x, PROP_defaultResponseHeaders)).run(v::set);
return v.get();
}
@@ -5088,9 +5093,9 @@ public class RestContext extends Context {
jsonSchemaGenerator = bs.add(JsonSchemaGenerator.class,
builder.jsonSchemaGenerator().build());
staticFiles = bs.add(StaticFiles.class,
builder.staticFiles().orElse(null));
bs.add(FileFinder.class, staticFiles);
- defaultRequestHeaders = bs.add(HeaderList.class,
builder.defaultRequestHeaders(), "defaultRequestHeaders");
- defaultResponseHeaders = bs.add(HeaderList.class,
builder.defaultResponseHeaders(), "defaultResponseHeaders");
- defaultRequestAttributes =
bs.add(NamedAttributeMap.class, builder.defaultRequestAttributes(),
"defaultRequestAttributes");
+ defaultRequestHeaders = bs.add(HeaderList.class,
builder.defaultRequestHeaders(), PROP_defaultRequestHeaders);
+ defaultResponseHeaders = bs.add(HeaderList.class,
builder.defaultResponseHeaders(), PROP_defaultResponseHeaders);
+ defaultRequestAttributes =
bs.add(NamedAttributeMap.class, builder.defaultRequestAttributes(),
PROP_defaultRequestAttributes);
restOpArgs = builder.restOpArgs().build().asArray();
debugEnablement = bs.add(DebugEnablement.class,
builder.debugEnablement().orElse(null));
startCallMethods =
builder.startCallMethods().stream().map(this::toMethodInvoker).toArray(MethodInvoker[]::new);
@@ -6196,8 +6201,8 @@ public class RestContext extends Context {
.a("beanStore", beanStore)
.a("clientVersionHeader", clientVersionHeader)
.a("consumes", consumes)
- .a("defaultRequestHeaders", defaultRequestHeaders)
- .a("defaultResponseHeaders", defaultResponseHeaders)
+ .a(PROP_defaultRequestHeaders, defaultRequestHeaders)
+ .a(PROP_defaultResponseHeaders, defaultResponseHeaders)
.a("partParser", partParser)
.a("partSerializer", partSerializer)
.a("produces", produces)
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestResponse.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestResponse.java
index 2baca4a305..f51331a9b9 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestResponse.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestResponse.java
@@ -110,6 +110,8 @@ import jakarta.servlet.http.*;
@SuppressWarnings("resource")
public class RestResponse extends HttpServletResponseWrapper {
+ private static final String HEADER_ContentType = "Content-Type";
+
private HttpServletResponse inner;
private final RestRequest request;
@@ -233,7 +235,7 @@ public class RestResponse extends
HttpServletResponseWrapper {
@Override
public void addHeader(String name, String value) {
if (nn(name) && nn(value)) {
- if (eqic(name, "Content-Type"))
+ if (eqic(name, HEADER_ContentType))
setHeader(name, value);
else {
if (safeHeaders)
@@ -732,7 +734,7 @@ public class RestResponse extends
HttpServletResponseWrapper {
// Jetty doesn't set the content type correctly if set through
this method.
// Tomcat/WAS does.
- if (eqic(name, "Content-Type")) {
+ if (eqic(name, HEADER_ContentType)) {
inner.setContentType(value);
ContentType ct = contentType(value);
if (nn(ct) && nn(ct.getParameter("charset")))
@@ -815,7 +817,7 @@ public class RestResponse extends
HttpServletResponseWrapper {
// If plain text requested, override it now.
if (request.isPlainText())
- setHeader("Content-Type", "text/plain");
+ setHeader(HEADER_ContentType, "text/plain");
try {
OutputStream out = (raw ? getOutputStream() :
getNegotiatedOutputStream());
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/debug/DebugEnablement.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/debug/DebugEnablement.java
index 6e8a82edde..32d02ea79b 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/debug/DebugEnablement.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/debug/DebugEnablement.java
@@ -41,6 +41,8 @@ import jakarta.servlet.http.*;
*/
public abstract class DebugEnablement {
+ private static final String HEADER_Debug = "Debug";
+
/**
* Builder class.
*/
@@ -59,7 +61,7 @@ public abstract class DebugEnablement {
protected Builder(BasicBeanStore beanStore) {
mapBuilder = ReflectionMap.create(Enablement.class);
defaultEnablement = NEVER;
- conditional = x -> eqic("true", x.getHeader("Debug"));
+ conditional = x -> eqic("true",
x.getHeader(HEADER_Debug));
creator = BeanCreator.of(DebugEnablement.class,
beanStore).type(BasicDebugEnablement.class).builder(Builder.class, this);
}
@@ -226,7 +228,7 @@ public abstract class DebugEnablement {
var builder = init(beanStore);
this.defaultEnablement =
firstNonNull(builder.defaultEnablement, NEVER);
this.enablementMap = builder.mapBuilder.build();
- this.conditionalPredicate = firstNonNull(builder.conditional, x
-> eqic("true", x.getHeader("Debug")));
+ this.conditionalPredicate = firstNonNull(builder.conditional, x
-> eqic("true", x.getHeader(HEADER_Debug)));
}
/**
@@ -237,7 +239,7 @@ public abstract class DebugEnablement {
protected DebugEnablement(Builder builder) {
this.defaultEnablement =
firstNonNull(builder.defaultEnablement, NEVER);
this.enablementMap = builder.mapBuilder.build();
- this.conditionalPredicate = firstNonNull(builder.conditional, x
-> eqic("true", x.getHeader("Debug")));
+ this.conditionalPredicate = firstNonNull(builder.conditional, x
-> eqic("true", x.getHeader(HEADER_Debug)));
}