Polishing

This commit is contained in:
Juergen Hoeller
2018-07-25 14:16:02 +02:00
parent 3899b7a909
commit 3881a4aded
39 changed files with 133 additions and 147 deletions

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.core.codec;
import java.util.Collections;
@@ -34,7 +35,6 @@ public abstract class Hints {
/**
* Name of hint exposing a prefix to use for correlating log messages.
* @since 5.1
*/
public static final String LOG_PREFIX_HINT = Log.class.getName() + ".PREFIX";
@@ -42,7 +42,6 @@ public abstract class Hints {
* Name of boolean hint whether to avoid logging data either because it's
* potentially sensitive, or because it has been logged by a composite
* encoder, e.g. for multipart requests.
* @since 5.1
*/
public static final String SUPPRESS_LOGGING_HINT = Log.class.getName() + ".SUPPRESS_LOGGING";
@@ -91,7 +90,7 @@ public abstract class Hints {
* @return the log prefix
*/
public static String getLogPrefix(@Nullable Map<String, Object> hints) {
return hints != null ? (String) hints.getOrDefault(LOG_PREFIX_HINT, "") : "";
return (hints != null ? (String) hints.getOrDefault(LOG_PREFIX_HINT, "") : "");
}
/**
@@ -100,7 +99,7 @@ public abstract class Hints {
* @return whether logging of data is allowed
*/
public static boolean isLoggingSuppressed(@Nullable Map<String, Object> hints) {
return hints != null && (boolean) hints.getOrDefault(SUPPRESS_LOGGING_HINT, false);
return (hints != null && (boolean) hints.getOrDefault(SUPPRESS_LOGGING_HINT, false));
}
/**

View File

@@ -39,30 +39,26 @@ public interface Profiles {
*/
boolean matches(Predicate<String> activeProfiles);
/**
* Create a new {@link Profiles} instance that checks for matches against
* the given <em>profile strings</em>.
*
* <p>The returned instance will {@linkplain Profiles#matches(Predicate) match}
* if any one of the given profile strings matches.
*
* <p>A profile string may contain a simple profile name (for example
* {@code "production"}) or a profile expression. A profile expression allows
* for more complicated profile logic to be expressed, for example
* {@code "production & cloud"}.
*
* <p>The following operators are supported in profile expressions:
* <ul>
* <li>{@code !} - A logical <em>not</em> of the profile</li>
* <li>{@code &} - A logical <em>and</em> of the profiles</li>
* <li>{@code |} - A logical <em>or</em> of the profiles</li>
* </ul>
*
* <p>Please note that the {@code &} and {@code |} operators may not be mixed
* without using parentheses. For example {@code "a & b | c"} is not a valid
* expression; it must be expressed as {@code "(a & b) | c"} or
* {@code "a & (b | c)"}.
*
* @param profiles the <em>profile strings</em> to include
* @return a new {@link Profiles} instance
*/