Skip to content

Commit 7316dc7

Browse files
committed
Polish Javadoc for MessageSourceSupport
See gh-26874
1 parent 118c7f9 commit 7316dc7

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

spring-context/src/main/java/org/springframework/context/support/MessageSourceSupport.java

+18-17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -57,25 +57,26 @@ public abstract class MessageSourceSupport {
5757

5858

5959
/**
60-
* Set whether to always apply the {@code MessageFormat} rules,
61-
* parsing even messages without arguments.
62-
* <p>Default is "false": Messages without arguments are by default
63-
* returned as-is, without parsing them through MessageFormat.
64-
* Set this to "true" to enforce MessageFormat for all messages,
65-
* expecting all message texts to be written with MessageFormat escaping.
66-
* <p>For example, MessageFormat expects a single quote to be escaped
67-
* as <code>"''"</code>. If your message texts are all written with such escaping,
68-
* even when not defining argument placeholders, you need to set this
69-
* flag to "true". Else, only message texts with actual arguments
70-
* are supposed to be written with MessageFormat escaping.
60+
* Set whether to always apply the {@code MessageFormat} rules, parsing even
61+
* messages without arguments.
62+
* <p>Default is {@code false}: Messages without arguments are by default
63+
* returned as-is, without parsing them through {@code MessageFormat}.
64+
* Set this to {@code true} to enforce {@code MessageFormat} for all messages,
65+
* expecting all message texts to be written with {@code MessageFormat} escaping.
66+
* <p>For example, {@code MessageFormat} expects a single quote to be escaped
67+
* as two adjacent single quotes ({@code "''"}). If your message texts are all
68+
* written with such escaping, even when not defining argument placeholders,
69+
* you need to set this flag to {@code true}. Otherwise, only message texts
70+
* with actual arguments are supposed to be written with {@code MessageFormat}
71+
* escaping.
7172
* @see java.text.MessageFormat
7273
*/
7374
public void setAlwaysUseMessageFormat(boolean alwaysUseMessageFormat) {
7475
this.alwaysUseMessageFormat = alwaysUseMessageFormat;
7576
}
7677

7778
/**
78-
* Return whether to always apply the MessageFormat rules, parsing even
79+
* Return whether to always apply the {@code MessageFormat} rules, parsing even
7980
* messages without arguments.
8081
*/
8182
protected boolean isAlwaysUseMessageFormat() {
@@ -150,10 +151,10 @@ protected String formatMessage(String msg, @Nullable Object[] args, Locale local
150151
}
151152

152153
/**
153-
* Create a MessageFormat for the given message and Locale.
154-
* @param msg the message to create a MessageFormat for
155-
* @param locale the Locale to create a MessageFormat for
156-
* @return the MessageFormat instance
154+
* Create a {@code MessageFormat} for the given message and Locale.
155+
* @param msg the message to create a {@code MessageFormat} for
156+
* @param locale the Locale to create a {@code MessageFormat} for
157+
* @return the {@code MessageFormat} instance
157158
*/
158159
protected MessageFormat createMessageFormat(String msg, Locale locale) {
159160
return new MessageFormat(msg, locale);

0 commit comments

Comments
 (0)