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 a6e5451 Rewrite Messages API.
a6e5451 is described below
commit a6e5451d701797b458ae3228580440816bba4b9b
Author: JamesBognar <[email protected]>
AuthorDate: Sun Jul 26 17:33:25 2020 -0400
Rewrite Messages API.
---
.../java/org/apache/juneau/cp/Messages_Test.java | 26 ++---
.../main/java/org/apache/juneau/cp/Messages.java | 112 +++++++++++++++------
.../java/org/apache/juneau/cp/MessagesBuilder.java | 2 +-
.../apache/juneau/rest/BasicRestInfoProvider.java | 6 +-
.../org/apache/juneau/rest/RestParamDefaults.java | 4 +-
.../java/org/apache/juneau/rest/RestRequest.java | 6 +-
.../org/apache/juneau/rest/SwaggerGenerator.java | 37 ++++---
7 files changed, 115 insertions(+), 78 deletions(-)
diff --git
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/cp/Messages_Test.java
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/cp/Messages_Test.java
index 60f8cb4..13197fb 100644
---
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/cp/Messages_Test.java
+++
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/cp/Messages_Test.java
@@ -30,7 +30,6 @@ public class Messages_Test {
public void a01_sameDirectory() throws Exception {
Messages x1 = Messages.of(MessageBundleTest1.class);
assertString(x1.getString("file")).is("MessageBundleTest1.properties");
- assertString(x1.getString(JAPANESE,
"file")).is("MessageBundleTest1_ja.properties");
assertString(x1.forLocale(JAPANESE).getString("file")).is("MessageBundleTest1_ja.properties");
assertString(x1.forLocale(JAPAN).getString("file")).is("MessageBundleTest1_ja_JP.properties");
assertString(x1.forLocale(CHINA).getString("file")).is("MessageBundleTest1.properties");
@@ -41,7 +40,6 @@ public class Messages_Test {
public void a02_customName() throws Exception {
Messages x1 = Messages.of(MessageBundleTest1.class,
"files/Test1");
assertString(x1.getString("file")).is("files/Test1.properties");
- assertString(x1.getString(JAPANESE,
"file")).is("files/Test1_ja.properties");
assertString(x1.forLocale(JAPANESE).getString("file")).is("files/Test1_ja.properties");
assertString(x1.forLocale(JAPAN).getString("file")).is("files/Test1_ja_JP.properties");
assertString(x1.forLocale(CHINA).getString("file")).is("files/Test1.properties");
@@ -49,7 +47,6 @@ public class Messages_Test {
Messages x2 =
Messages.create(MessageBundleTest1.class).name(null).build();
assertString(x2.getString("file")).is("MessageBundleTest1.properties");
- assertString(x2.getString(JAPANESE,
"file")).is("MessageBundleTest1_ja.properties");
assertString(x2.forLocale(JAPANESE).getString("file")).is("MessageBundleTest1_ja.properties");
assertString(x2.forLocale(JAPAN).getString("file")).is("MessageBundleTest1_ja_JP.properties");
assertString(x2.forLocale(CHINA).getString("file")).is("MessageBundleTest1.properties");
@@ -60,7 +57,6 @@ public class Messages_Test {
public void a03_customSearchPaths() throws Exception {
Messages x =
Messages.create(MessageBundleTest1.class).name("Test1").baseNames("{package}.files.{name}").build();
assertString(x.getString("file")).is("files/Test1.properties");
- assertString(x.getString(JAPANESE,
"file")).is("files/Test1_ja.properties");
assertString(x.forLocale(JAPANESE).getString("file")).is("files/Test1_ja.properties");
assertString(x.forLocale(JAPAN).getString("file")).is("files/Test1_ja_JP.properties");
assertString(x.forLocale(CHINA).getString("file")).is("files/Test1.properties");
@@ -74,7 +70,6 @@ public class Messages_Test {
public void a04_customLocale() throws Exception {
Messages x1 =
Messages.create(MessageBundleTest1.class).locale(Locale.JAPAN).build();
assertString(x1.getString("file")).is("MessageBundleTest1_ja_JP.properties");
- assertString(x1.getString(JAPANESE,
"file")).is("MessageBundleTest1_ja.properties");
assertString(x1.forLocale(JAPANESE).getString("file")).is("MessageBundleTest1_ja.properties");
assertString(x1.forLocale(JAPAN).getString("file")).is("MessageBundleTest1_ja_JP.properties");
assertString(x1.forLocale(CHINA).getString("file")).is("MessageBundleTest1.properties");
@@ -82,7 +77,6 @@ public class Messages_Test {
Messages x2 =
Messages.create(MessageBundleTest1.class).locale(null).build();
assertString(x2.getString("file")).is("MessageBundleTest1.properties");
- assertString(x2.getString(JAPANESE,
"file")).is("MessageBundleTest1_ja.properties");
assertString(x2.forLocale(JAPANESE).getString("file")).is("MessageBundleTest1_ja.properties");
assertString(x2.forLocale(JAPAN).getString("file")).is("MessageBundleTest1_ja_JP.properties");
assertString(x2.forLocale(CHINA).getString("file")).is("MessageBundleTest1.properties");
@@ -93,7 +87,6 @@ public class Messages_Test {
public void a05_nonExistentBundle() throws Exception {
Messages x1 = Messages.of(MessageBundleTest1.class, "Bad");
assertString(x1.getString("file")).is("{!file}");
- assertString(x1.getString(JAPANESE, "file")).is("{!file}");
assertString(x1.forLocale(JAPANESE).getString("file")).is("{!file}");
assertString(x1.forLocale(JAPAN).getString("file")).is("{!file}");
assertString(x1.forLocale(CHINA).getString("file")).is("{!file}");
@@ -107,7 +100,6 @@ public class Messages_Test {
public void a06_parent() throws Exception {
Messages x1 =
Messages.create(MessageBundleTest1.class).name("Bad").parent(Messages.of(Test2.class)).build();
assertString(x1.getString("file")).is("Test2.properties");
- assertString(x1.getString(JAPANESE,
"file")).is("Test2_ja.properties");
assertString(x1.forLocale(JAPANESE).getString("file")).is("Test2_ja.properties");
assertString(x1.forLocale(JAPAN).getString("file")).is("Test2_ja_JP.properties");
assertString(x1.forLocale(CHINA).getString("file")).is("Test2.properties");
@@ -142,12 +134,12 @@ public class Messages_Test {
assertString(x.getString("foo","bar")).is("foo bar");
assertString(x.getString("bar","bar")).is("bar bar");
assertString(x.getString("baz","bar")).is("{!baz}");
- assertString(x.getString(JAPAN, "foo","bar")).is("fooja bar");
- assertString(x.getString(CHINA, "foo","bar")).is("foo bar");
- assertString(x.getString((Locale)null, "foo","bar")).is("foo
bar");
- assertString(x.getString(JAPAN, "baz")).is("baz");
- assertString(x.getString(CHINA, "baz")).is("{!baz}");
- assertString(x.getString((Locale)null, "baz")).is("{!baz}");
+
assertString(x.forLocale(JAPAN).getString("foo","bar")).is("fooja bar");
+ assertString(x.forLocale(CHINA).getString("foo","bar")).is("foo
bar");
+ assertString(x.forLocale(null).getString("foo","bar")).is("foo
bar");
+ assertString(x.forLocale(JAPAN).getString("baz")).is("baz");
+ assertString(x.forLocale(CHINA).getString("baz")).is("{!baz}");
+ assertString(x.forLocale(null).getString("baz")).is("{!baz}");
}
@Test
@@ -155,9 +147,9 @@ public class Messages_Test {
Messages x = Messages.of(MessageBundleTest1.class);
assertString(x.findFirstString("baz","foo")).is("foo {0}");
assertString(x.findFirstString("baz","baz")).isNull();
- assertString(x.findFirstString(JAPAN,"baz","foo")).is("baz");
- assertString(x.findFirstString(CHINA,"baz","baz")).isNull();
-
assertString(x.findFirstString((Locale)null,"baz","baz")).isNull();
+
assertString(x.forLocale(JAPAN).findFirstString("baz","foo")).is("baz");
+
assertString(x.forLocale(CHINA).findFirstString("baz","baz")).isNull();
+
assertString(x.forLocale(null).findFirstString("baz","baz")).isNull();
}
@Test
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/Messages.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/Messages.java
index 7cadfad..368faa4 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/Messages.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/Messages.java
@@ -23,16 +23,87 @@ import org.apache.juneau.collections.*;
import org.apache.juneau.marshall.*;
/**
- * A wrapper around a {@link ResourceBundle}.
+ * An enhanced {@link ResourceBundle}.
*
* <p>
- * Adds support for non-existent resource bundles and associating class
loaders.
+ * Wraps a ResourceBundle to provide some useful additional functionality.
+ *
+ * <ul>
+ * <li>
+ * Instead of throwing {@link MissingResourceException}, the
{@link ResourceBundle#getString(String)} method
+ * will return <js>"{!key}"</js> if the message could not be found.
+ * <li>
+ * Supported hierarchical lookup of resources from parent parent
classes.
+ * <li>
+ * Support for easy retrieval of localized bundles.
+ * <li>
+ * Support for generalized resource bundles (e.g. properties files
containing keys for several classes).
+ * </ul>
+ *
+ * <p>
+ * The following example shows the basic usage of this class for retrieving
localized messages:
+ *
+ * <p class='bcode w800'>
+ * <cc># Contents of MyClass.properties</cc>
+ * <ck>foo</ck> = <cv>foo {0}</cv>
+ * <ck>MyClass.bar</ck> = <cv>bar {0}</cv>
+ * </p>
+ * <p class='bcode w800'>
+ * <jk>public class</jk> MyClass {
+ * <jk>private static final</jk> Messages <jsf>MESSAGES</jsf> =
Messages.<jsm>of</jsm>(MyClass.<jk>class</jk>);
+ *
+ * <jk>public void</jk> doFoo() {
+ *
+ * <jc>// A normal property.</jc>
+ * String <jv>foo</jv> =
<jsf>MESSAGES</jsf>.getString(<js>"foo"</js>,<js>"x"</js>); <jc>// == "foo
x"</jc>
+ *
+ * <jc>// A property prefixed by class name.</jc>
+ * String <jv>bar</jv> =
<jsf>MESSAGES</jsf>.getString(<js>"bar"</js>,<js>"x"</js>); <jc>// == "bar
x"</jc>
+ *
+ * <jc>// A non-existent property.</jc>
+ * String <jv>baz</jv> =
<jsf>MESSAGES</jsf>.getString(<js>"baz"</js>,<js>"x"</js>); <jc>// ==
"{!baz}"</jc>
+ * }
+ * }
+ * </p>
+ *
+ * <p>
+ * The ability to resolve keys prefixed by class name allows you to place
all your messages in a single file such
+ * as a common <js>"Messages.properties"</js> file along with those for
other classes.
+ * <p>
+ * The following shows how to retrieve messages from a common bundle:
+ *
+ * <p class='bcode w800'>
+ * <jk>public class</jk> MyClass {
+ * <jk>private static final</jk> Messages <jsf>MESSAGES</jsf> =
Messages.<jsm>of</jsm>(MyClass.<jk>class</jk>, <js>"Messages"</js>);
+ * }
+ * </p>
+ *
+ * <p>
+ * Resource bundles are searched using the following base name patterns:
+ * <ul>
+ * <li><js>"{package}.{name}"</js>
+ * <li><js>"{package}.i18n.{name}"</js>
+ * <li><js>"{package}.nls.{name}"</js>
+ * <li><js>"{package}.messages.{name}"</js>
+ * </ul>
+ *
+ * <p>
+ * These patterns can be customized using the {@link
MessagesBuilder#baseNames(String...)} method.
+ *
+ * <p>
+ * Localized messages can be retrieved in the following way:
+ *
+* <p class='bcode w800'>
+* <jc>// Return value from Japan locale bundle.</jc>
+* String <jv>foo</jv> =
<jsf>MESSAGES</jsf>.forLocale(Locale.<jsf>JAPAN</jsf>).getString(<js>"foo"</js>);
+ * </p>
*/
public class Messages extends ResourceBundle {
private ResourceBundle rb;
private Class<?> c;
private Messages parent;
+ private Locale locale;
// Cache of message bundles per locale.
private final ConcurrentHashMap<Locale,Messages> localizedMessages =
new ConcurrentHashMap<>();
@@ -86,15 +157,17 @@ public class Messages extends ResourceBundle {
* The class we're creating this object for.
* @param rb
* The resource bundle we're encapsulating. Can be <jk>null</jk>.
+ * @param locale The locale of these messages.
* @param parent
* The parent resource. Can be <jk>null</jk>.
*/
- public Messages(Class<?> forClass, ResourceBundle rb, Messages parent) {
+ public Messages(Class<?> forClass, ResourceBundle rb, Locale locale,
Messages parent) {
this.c = forClass;
this.rb = rb;
this.parent = parent;
if (parent != null)
setParent(parent);
+ this.locale = locale == null ? Locale.getDefault() : locale;
Map<String,String> keyMap = new TreeMap<>();
@@ -131,11 +204,13 @@ public class Messages extends ResourceBundle {
public Messages forLocale(Locale locale) {
if (locale == null)
locale = Locale.getDefault();
+ if (this.locale.equals(locale))
+ return this;
Messages mb = localizedMessages.get(locale);
if (mb == null) {
Messages parent = this.parent == null ? null :
this.parent.forLocale(locale);
ResourceBundle rb = this.rb == null ? null :
findBundle(this.rb.getBaseBundleName(), locale, c.getClassLoader());
- mb = new Messages(c, rb, parent);
+ mb = new Messages(c, rb, locale, parent);
localizedMessages.put(locale, mb);
}
return mb;
@@ -176,23 +251,6 @@ public class Messages extends ResourceBundle {
}
/**
- * Same as {@link #getString(String, Object...)} but allows you to
specify the locale.
- *
- * @param locale The locale of the resource bundle to retrieve message
from.
- * @param key The resource bundle key.
- * @param args Optional {@link MessageFormat}-style arguments.
- * @return
- * The resolved value. Never <jk>null</jk>.
- * <js>"{!!key}"</js> if the bundle is missing.
- * <js>"{!key}"</js> if the key is missing.
- */
- public String getString(Locale locale, String key, Object...args) {
- if (locale == null)
- return getString(key, args);
- return forLocale(locale).getString(key, args);
- }
-
- /**
* Looks for all the specified keys in the resource bundle and returns
the first value that exists.
*
* @param keys The list of possible keys.
@@ -206,18 +264,6 @@ public class Messages extends ResourceBundle {
return null;
}
- /**
- * Same as {@link #findFirstString(String...)}, but uses the specified
locale.
- *
- * @param locale The locale of the resource bundle to retrieve message
from.
- * @param keys The list of possible keys.
- * @return The resolved value, or <jk>null</jk> if no value is found or
the resource bundle is missing.
- */
- public String findFirstString(Locale locale, String...keys) {
- Messages srb = forLocale(locale);
- return srb.findFirstString(keys);
- }
-
@Override /* ResourceBundle */
protected Object handleGetObject(String key) {
String k = keyMap.get(key);
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/MessagesBuilder.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/MessagesBuilder.java
index 5a60e01..9f698a2 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/MessagesBuilder.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/MessagesBuilder.java
@@ -99,7 +99,7 @@ public class MessagesBuilder {
* @return A new {@link Messages} object.
*/
public Messages build() {
- return new Messages(forClass, getBundle(), parent);
+ return new Messages(forClass, getBundle(), locale, parent);
}
private ResourceBundle getBundle() {
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestInfoProvider.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestInfoProvider.java
index 0b63f17..2d7d342 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestInfoProvider.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestInfoProvider.java
@@ -285,7 +285,7 @@ public class BasicRestInfoProvider implements
RestInfoProvider {
VarResolverSession vr = req.getVarResolverSession();
if (siteName != null)
return vr.resolve(siteName);
- String siteName =
context.getMessages().findFirstString(req.getLocale(), "siteName");
+ String siteName =
context.getMessages().forLocale(req.getLocale()).findFirstString("siteName");
if (siteName != null)
return vr.resolve(siteName);
return null;
@@ -338,7 +338,7 @@ public class BasicRestInfoProvider implements
RestInfoProvider {
VarResolverSession vr = req.getVarResolverSession();
if (title != null)
return vr.resolve(title);
- String title =
context.getMessages().findFirstString(req.getLocale(), "title");
+ String title =
context.getMessages().forLocale(req.getLocale()).findFirstString("title");
if (title != null)
return vr.resolve(title);
return null;
@@ -391,7 +391,7 @@ public class BasicRestInfoProvider implements
RestInfoProvider {
VarResolverSession vr = req.getVarResolverSession();
if (description != null)
return vr.resolve(description);
- String description =
context.getMessages().findFirstString(req.getLocale(), "description");
+ String description =
context.getMessages().forLocale(req.getLocale()).findFirstString("description");
if (description != null)
return vr.resolve(description);
return null;
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestParamDefaults.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestParamDefaults.java
index ac8a3b4..0aac0fd 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestParamDefaults.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestParamDefaults.java
@@ -582,7 +582,7 @@ class RestParamDefaults {
@Override /* RestMethodParam */
public Object resolve(RestRequest req, RestResponse res) throws
Exception {
- return req.getMessageBundle();
+ return req.getMessages();
}
}
@@ -594,7 +594,7 @@ class RestParamDefaults {
@Override /* RestMethodParam */
public Object resolve(RestRequest req, RestResponse res) throws
Exception {
- return req.getMessageBundle();
+ return req.getMessages();
}
}
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestRequest.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestRequest.java
index ad4ae46..8c3990d 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestRequest.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestRequest.java
@@ -1249,19 +1249,19 @@ public final class RestRequest extends
HttpServletRequestWrapper {
* The resource bundle.
* <br>Never <jk>null</jk>.
*/
- public Messages getMessageBundle() {
+ public Messages getMessages() {
return context.getMessages().forLocale(getLocale());
}
/**
- * Shortcut method for calling {@link Messages#getString(Locale,
String, Object...)} based on the request locale.
+ * Shortcut method for calling {@link RestRequest#getMessages()} and
{@link Messages#getString(String,Object...)}.
*
* @param key The message key.
* @param args Optional {@link MessageFormat}-style arguments.
* @return The localized message.
*/
public String getMessage(String key, Object...args) {
- return context.getMessages().getString(getLocale(), key, args);
+ return getMessages().getString(key, args);
}
/**
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/SwaggerGenerator.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/SwaggerGenerator.java
index bd3af28..0aef1cb 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/SwaggerGenerator.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/SwaggerGenerator.java
@@ -86,7 +86,7 @@ final class SwaggerGenerator {
this.js = context.getJsonSchemaGenerator().createSession();
this.c = context.getResource().getClass();
this.resource = context.getResource();
- this.mb = context.getMessages();
+ this.mb = context.getMessages().forLocale(locale);
}
/**
@@ -233,18 +233,17 @@ final class SwaggerGenerator {
);
}
-
- omSwagger.ase("externalDocs",
parseMap(mb.findFirstString(locale, "externalDocs"), "Messages/externalDocs on
class {0}", c));
+ omSwagger.ase("externalDocs",
parseMap(mb.findFirstString("externalDocs"), "Messages/externalDocs on class
{0}", c));
OMap info = omSwagger.getMap("info", true);
info
- .ase("title", resolve(mb.findFirstString(locale,
"title")))
- .ase("description", resolve(mb.findFirstString(locale,
"description")))
- .ase("version", resolve(mb.findFirstString(locale,
"version")))
- .ase("termsOfService",
resolve(mb.findFirstString(locale, "termsOfService")))
- .ase("contact", parseMap(mb.findFirstString(locale,
"contact"), "Messages/contact on class {0}", c))
- .ase("license", parseMap(mb.findFirstString(locale,
"license"), "Messages/license on class {0}", c));
+ .ase("title", resolve(mb.findFirstString("title")))
+ .ase("description",
resolve(mb.findFirstString("description")))
+ .ase("version", resolve(mb.findFirstString("version")))
+ .ase("termsOfService",
resolve(mb.findFirstString("termsOfService")))
+ .ase("contact", parseMap(mb.findFirstString("contact"),
"Messages/contact on class {0}", c))
+ .ase("license", parseMap(mb.findFirstString("license"),
"Messages/license on class {0}", c));
if (info.isEmpty())
omSwagger.remove("info");
@@ -267,7 +266,7 @@ final class SwaggerGenerator {
}
}
- String s = mb.findFirstString(locale, "tags");
+ String s = mb.findFirstString("tags");
if (s != null) {
for (OMap m : parseListOrCdl(s, "Messages/tags on class
{0}", c).elements(OMap.class)) {
String name = m.getString("name");
@@ -312,7 +311,7 @@ final class SwaggerGenerator {
op.ase("summary",
firstNonEmpty(
resolve(ms.summary()),
- resolve(mb.findFirstString(locale, mn +
".summary")),
+ resolve(mb.findFirstString(mn +
".summary")),
op.getString("summary"),
resolve(rm.summary())
)
@@ -320,7 +319,7 @@ final class SwaggerGenerator {
op.ase("description",
firstNonEmpty(
resolve(ms.description()),
- resolve(mb.findFirstString(locale, mn +
".description")),
+ resolve(mb.findFirstString(mn +
".description")),
op.getString("description"),
resolve(rm.description())
)
@@ -333,44 +332,44 @@ final class SwaggerGenerator {
);
op.ase("tags",
merge(
-
parseListOrCdl(mb.findFirstString(locale, mn + ".tags"), "Messages/tags on
class {0} method {1}", c, m),
+ parseListOrCdl(mb.findFirstString(mn +
".tags"), "Messages/tags on class {0} method {1}", c, m),
parseListOrCdl(ms.tags(),
"@MethodSwagger(tags) on class {0} method {1}", c, m)
)
);
op.ase("schemes",
merge(
-
parseListOrCdl(mb.findFirstString(locale, mn + ".schemes"), "Messages/schemes
on class {0} method {1}", c, m),
+ parseListOrCdl(mb.findFirstString(mn +
".schemes"), "Messages/schemes on class {0} method {1}", c, m),
parseListOrCdl(ms.schemes(),
"@MethodSwagger(schemes) on class {0} method {1}", c, m)
)
);
op.ase("consumes",
firstNonEmpty(
-
parseListOrCdl(mb.findFirstString(locale, mn + ".consumes"), "Messages/consumes
on class {0} method {1}", c, m),
+ parseListOrCdl(mb.findFirstString(mn +
".consumes"), "Messages/consumes on class {0} method {1}", c, m),
parseListOrCdl(ms.consumes(),
"@MethodSwagger(consumes) on class {0} method {1}", c, m)
)
);
op.ase("produces",
firstNonEmpty(
-
parseListOrCdl(mb.findFirstString(locale, mn + ".produces"), "Messages/produces
on class {0} method {1}", c, m),
+ parseListOrCdl(mb.findFirstString(mn +
".produces"), "Messages/produces on class {0} method {1}", c, m),
parseListOrCdl(ms.produces(),
"@MethodSwagger(produces) on class {0} method {1}", c, m)
)
);
op.ase("parameters",
merge(
- parseList(mb.findFirstString(locale, mn
+ ".parameters"), "Messages/parameters on class {0} method {1}", c, m),
+ parseList(mb.findFirstString(mn +
".parameters"), "Messages/parameters on class {0} method {1}", c, m),
parseList(ms.parameters(),
"@MethodSwagger(parameters) on class {0} method {1}", c, m)
)
);
op.ase("responses",
merge(
- parseMap(mb.findFirstString(locale, mn
+ ".responses"), "Messages/responses on class {0} method {1}", c, m),
+ parseMap(mb.findFirstString(mn +
".responses"), "Messages/responses on class {0} method {1}", c, m),
parseMap(ms.responses(),
"@MethodSwagger(responses) on class {0} method {1}", c, m)
)
);
op.ase("externalDocs",
merge(
op.getMap("externalDocs"),
- parseMap(mb.findFirstString(locale, mn
+ ".externalDocs"), "Messages/externalDocs on class {0} method {1}", c, m),
+ parseMap(mb.findFirstString(mn +
".externalDocs"), "Messages/externalDocs on class {0} method {1}", c, m),
toMap(ms.externalDocs(),
"@MethodSwagger(externalDocs) on class {0} method {1}", c, m)
)
);