Skip to content

Commit 687d350

Browse files
committed
Polishing
1 parent 73dfa9a commit 687d350

File tree

9 files changed

+77
-67
lines changed

9 files changed

+77
-67
lines changed

spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 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.
@@ -412,7 +412,7 @@ protected TargetSource getCustomTargetSource(Class<?> beanClass, String beanName
412412
// Found a matching TargetSource.
413413
if (logger.isDebugEnabled()) {
414414
logger.debug("TargetSourceCreator [" + tsc +
415-
" found custom TargetSource for bean with name '" + beanName + "'");
415+
"] found custom TargetSource for bean with name '" + beanName + "'");
416416
}
417417
return ts;
418418
}
@@ -553,7 +553,7 @@ private Advisor[] resolveInterceptorNames() {
553553
* Subclasses may choose to implement this: for example,
554554
* to change the interfaces exposed.
555555
* <p>The default implementation is empty.
556-
* @param proxyFactory ProxyFactory that is already configured with
556+
* @param proxyFactory a ProxyFactory that is already configured with
557557
* TargetSource and interfaces and will be used to create the proxy
558558
* immediately after this method returns
559559
*/

spring-beans/src/main/java/org/springframework/beans/factory/annotation/InjectionMetadata.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2018 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.
@@ -80,9 +80,8 @@ public void inject(Object target, String beanName, PropertyValues pvs) throws Th
8080
Collection<InjectedElement> elementsToIterate =
8181
(this.checkedElements != null ? this.checkedElements : this.injectedElements);
8282
if (!elementsToIterate.isEmpty()) {
83-
boolean debug = logger.isDebugEnabled();
8483
for (InjectedElement element : elementsToIterate) {
85-
if (debug) {
84+
if (logger.isDebugEnabled()) {
8685
logger.debug("Processing injected element of bean '" + beanName + "': " + element);
8786
}
8887
element.inject(target, beanName, pvs);
@@ -109,7 +108,10 @@ public static boolean needsRefresh(InjectionMetadata metadata, Class<?> clazz) {
109108
}
110109

111110

112-
public static abstract class InjectedElement {
111+
/**
112+
* A single injected element.
113+
*/
114+
public abstract static class InjectedElement {
113115

114116
protected final Member member;
115117

@@ -216,6 +218,7 @@ else if (pvs instanceof MutablePropertyValues) {
216218
}
217219

218220
/**
221+
* Clear property skipping for this element.
219222
* @since 3.2.13
220223
*/
221224
protected void clearPropertySkipping(PropertyValues pvs) {

spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -541,29 +541,29 @@ public <T> Map<String, T> getBeansOfType(Class<T> type, boolean includeNonSingle
541541

542542
@Override
543543
public String[] getBeanNamesForAnnotation(Class<? extends Annotation> annotationType) {
544-
List<String> results = new ArrayList<String>();
544+
List<String> result = new ArrayList<String>();
545545
for (String beanName : this.beanDefinitionNames) {
546546
BeanDefinition beanDefinition = getBeanDefinition(beanName);
547547
if (!beanDefinition.isAbstract() && findAnnotationOnBean(beanName, annotationType) != null) {
548-
results.add(beanName);
548+
result.add(beanName);
549549
}
550550
}
551551
for (String beanName : this.manualSingletonNames) {
552-
if (!results.contains(beanName) && findAnnotationOnBean(beanName, annotationType) != null) {
553-
results.add(beanName);
552+
if (!result.contains(beanName) && findAnnotationOnBean(beanName, annotationType) != null) {
553+
result.add(beanName);
554554
}
555555
}
556-
return StringUtils.toStringArray(results);
556+
return StringUtils.toStringArray(result);
557557
}
558558

559559
@Override
560560
public Map<String, Object> getBeansWithAnnotation(Class<? extends Annotation> annotationType) {
561561
String[] beanNames = getBeanNamesForAnnotation(annotationType);
562-
Map<String, Object> results = new LinkedHashMap<String, Object>(beanNames.length);
562+
Map<String, Object> result = new LinkedHashMap<String, Object>(beanNames.length);
563563
for (String beanName : beanNames) {
564-
results.put(beanName, getBean(beanName));
564+
result.put(beanName, getBean(beanName));
565565
}
566-
return results;
566+
return result;
567567
}
568568

569569
/**

spring-context/src/main/java/org/springframework/context/event/GenericApplicationListener.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2018 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.
@@ -23,23 +23,27 @@
2323

2424
/**
2525
* Extended variant of the standard {@link ApplicationListener} interface,
26-
* exposing further metadata such as the supported event type.
26+
* exposing further metadata such as the supported event and source type.
2727
*
28-
* <p>As of Spring Framework 4.2, supersedes {@link SmartApplicationListener} with
29-
* proper handling of generics-based event.
28+
* <p>As of Spring Framework 4.2, this interface supersedes the Class-based
29+
* {@link SmartApplicationListener} with full handling of generic event types.
3030
*
3131
* @author Stephane Nicoll
3232
* @since 4.2
33+
* @see SmartApplicationListener
34+
* @see GenericApplicationListenerAdapter
3335
*/
3436
public interface GenericApplicationListener extends ApplicationListener<ApplicationEvent>, Ordered {
3537

3638
/**
3739
* Determine whether this listener actually supports the given event type.
40+
* @param eventType the event type (never {@code null})
3841
*/
3942
boolean supportsEventType(ResolvableType eventType);
4043

4144
/**
4245
* Determine whether this listener actually supports the given source type.
46+
* @param sourceType the source type, or {@code null} if no source
4347
*/
4448
boolean supportsSourceType(Class<?> sourceType);
4549

spring-context/src/main/java/org/springframework/context/event/SmartApplicationListener.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2018 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.
@@ -22,25 +22,27 @@
2222

2323
/**
2424
* Extended variant of the standard {@link ApplicationListener} interface,
25-
* exposing further metadata such as the supported event type.
25+
* exposing further metadata such as the supported event and source type.
2626
*
27-
* <p>Users are <bold>strongly advised</bold> to use the {@link GenericApplicationListener}
28-
* interface instead as it provides an improved detection of generics-based
29-
* event types.
27+
* <p>For full introspection of generic event types, consider implementing
28+
* the {@link GenericApplicationListener} interface instead.
3029
*
3130
* @author Juergen Hoeller
3231
* @since 3.0
3332
* @see GenericApplicationListener
33+
* @see GenericApplicationListenerAdapter
3434
*/
3535
public interface SmartApplicationListener extends ApplicationListener<ApplicationEvent>, Ordered {
3636

3737
/**
3838
* Determine whether this listener actually supports the given event type.
39+
* @param eventType the event type (never {@code null})
3940
*/
4041
boolean supportsEventType(Class<? extends ApplicationEvent> eventType);
4142

4243
/**
4344
* Determine whether this listener actually supports the given source type.
45+
* @param sourceType the source type, or {@code null} if no source
4446
*/
4547
boolean supportsSourceType(Class<?> sourceType);
4648

spring-tx/src/main/java/org/springframework/transaction/TransactionStatus.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2018 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.
@@ -25,7 +25,7 @@
2525
* and to programmatically request a rollback (instead of throwing
2626
* an exception that causes an implicit rollback).
2727
*
28-
* <p>Derives from the SavepointManager interface to provide access
28+
* <p>Includes the {@link SavepointManager} interface to provide access
2929
* to savepoint management facilities. Note that savepoint management
3030
* is only available if supported by the underlying transaction manager.
3131
*
@@ -39,9 +39,9 @@
3939
public interface TransactionStatus extends SavepointManager, Flushable {
4040

4141
/**
42-
* Return whether the present transaction is new (else participating
43-
* in an existing transaction, or potentially not running in an
44-
* actual transaction in the first place).
42+
* Return whether the present transaction is new; otherwise participating
43+
* in an existing transaction, or potentially not running in an actual
44+
* transaction in the first place.
4545
*/
4646
boolean isNewTransaction();
4747

@@ -50,9 +50,9 @@ public interface TransactionStatus extends SavepointManager, Flushable {
5050
* that is, has been created as nested transaction based on a savepoint.
5151
* <p>This method is mainly here for diagnostic purposes, alongside
5252
* {@link #isNewTransaction()}. For programmatic handling of custom
53-
* savepoints, use SavepointManager's operations.
53+
* savepoints, use the operations provided by {@link SavepointManager}.
5454
* @see #isNewTransaction()
55-
* @see #createSavepoint
55+
* @see #createSavepoint()
5656
* @see #rollbackToSavepoint(Object)
5757
* @see #releaseSavepoint(Object)
5858
*/

spring-tx/src/main/java/org/springframework/transaction/interceptor/DefaultTransactionAttribute.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2018 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.
@@ -17,6 +17,7 @@
1717
package org.springframework.transaction.interceptor;
1818

1919
import org.springframework.transaction.support.DefaultTransactionDefinition;
20+
import org.springframework.util.StringUtils;
2021

2122
/**
2223
* Spring's common transaction attribute implementation.
@@ -136,7 +137,7 @@ public boolean rollbackOn(Throwable ex) {
136137
*/
137138
protected final StringBuilder getAttributeDescription() {
138139
StringBuilder result = getDefinitionDescription();
139-
if (this.qualifier != null) {
140+
if (StringUtils.hasText(this.qualifier)) {
140141
result.append("; '").append(this.qualifier).append("'");
141142
}
142143
return result;

spring-tx/src/main/java/org/springframework/transaction/support/DefaultTransactionStatus.java

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2018 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.
@@ -62,14 +62,14 @@ public class DefaultTransactionStatus extends AbstractTransactionStatus {
6262

6363

6464
/**
65-
* Create a new DefaultTransactionStatus instance.
66-
* @param transaction underlying transaction object that can hold
67-
* state for the internal transaction implementation
68-
* @param newTransaction if the transaction is new,
69-
* else participating in an existing transaction
70-
* @param newSynchronization if a new transaction synchronization
71-
* has been opened for the given transaction
72-
* @param readOnly whether the transaction is read-only
65+
* Create a new {@code DefaultTransactionStatus} instance.
66+
* @param transaction underlying transaction object that can hold state
67+
* for the internal transaction implementation
68+
* @param newTransaction if the transaction is new, otherwise participating
69+
* in an existing transaction
70+
* @param newSynchronization if a new transaction synchronization has been
71+
* opened for the given transaction
72+
* @param readOnly whether the transaction is marked as read-only
7373
* @param debug should debug logging be enabled for the handling of this transaction?
7474
* Caching it in here can prevent repeated calls to ask the logging system whether
7575
* debug logging should be enabled.
@@ -124,9 +124,9 @@ public boolean isReadOnly() {
124124
}
125125

126126
/**
127-
* Return whether the progress of this transaction is debugged. This is used
128-
* by AbstractPlatformTransactionManager as an optimization, to prevent repeated
129-
* calls to logger.isDebug(). Not really intended for client code.
127+
* Return whether the progress of this transaction is debugged. This is used by
128+
* {@link AbstractPlatformTransactionManager} as an optimization, to prevent repeated
129+
* calls to {@code logger.isDebugEnabled()}. Not really intended for client code.
130130
*/
131131
public boolean isDebug() {
132132
return this.debug;
@@ -146,11 +146,11 @@ public Object getSuspendedResources() {
146146
//---------------------------------------------------------------------
147147

148148
/**
149-
* Determine the rollback-only flag via checking both the transaction object,
150-
* provided that the latter implements the {@link SmartTransactionObject} interface.
151-
* <p>Will return "true" if the transaction itself has been marked rollback-only
152-
* by the transaction coordinator, for example in case of a timeout.
153-
* @see SmartTransactionObject#isRollbackOnly
149+
* Determine the rollback-only flag via checking the transaction object, provided
150+
* that the latter implements the {@link SmartTransactionObject} interface.
151+
* <p>Will return {@code true} if the global transaction itself has been marked
152+
* rollback-only by the transaction coordinator, for example in case of a timeout.
153+
* @see SmartTransactionObject#isRollbackOnly()
154154
*/
155155
@Override
156156
public boolean isGlobalRollbackOnly() {
@@ -159,8 +159,9 @@ public boolean isGlobalRollbackOnly() {
159159
}
160160

161161
/**
162-
* Delegate the flushing to the transaction object,
163-
* provided that the latter implements the {@link SmartTransactionObject} interface.
162+
* Delegate the flushing to the transaction object, provided that the latter
163+
* implements the {@link SmartTransactionObject} interface.
164+
* @see SmartTransactionObject#flush()
164165
*/
165166
@Override
166167
public void flush() {
@@ -170,23 +171,25 @@ public void flush() {
170171
}
171172

172173
/**
173-
* This implementation exposes the SavepointManager interface
174+
* This implementation exposes the {@link SavepointManager} interface
174175
* of the underlying transaction object, if any.
176+
* @throws NestedTransactionNotSupportedException if savepoints are not supported
177+
* @see #isTransactionSavepointManager()
175178
*/
176179
@Override
177180
protected SavepointManager getSavepointManager() {
178181
if (!isTransactionSavepointManager()) {
179182
throw new NestedTransactionNotSupportedException(
180-
"Transaction object [" + getTransaction() + "] does not support savepoints");
183+
"Transaction object [" + this.transaction + "] does not support savepoints");
181184
}
182185
return (SavepointManager) getTransaction();
183186
}
184187

185188
/**
186-
* Return whether the underlying transaction implements the
187-
* SavepointManager interface.
188-
* @see #getTransaction
189-
* @see org.springframework.transaction.SavepointManager
189+
* Return whether the underlying transaction implements the {@link SavepointManager}
190+
* interface and therefore supports savepoints.
191+
* @see #getTransaction()
192+
* @see #getSavepointManager()
190193
*/
191194
public boolean isTransactionSavepointManager() {
192195
return (getTransaction() instanceof SavepointManager);

spring-tx/src/main/java/org/springframework/transaction/support/SimpleTransactionStatus.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2018 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.
@@ -18,10 +18,8 @@
1818

1919
/**
2020
* A simple {@link org.springframework.transaction.TransactionStatus}
21-
* implementation.
22-
*
23-
* <p>Derives from {@link AbstractTransactionStatus} and adds an explicit
24-
* {@link #isNewTransaction() "newTransaction"} flag.
21+
* implementation. Derives from {@link AbstractTransactionStatus} and
22+
* adds an explicit {@link #isNewTransaction() "newTransaction"} flag.
2523
*
2624
* <p>This class is not used by any of Spring's pre-built
2725
* {@link org.springframework.transaction.PlatformTransactionManager}
@@ -32,24 +30,23 @@
3230
*
3331
* @author Juergen Hoeller
3432
* @since 1.2.3
35-
* @see #SimpleTransactionStatus(boolean)
36-
* @see TransactionCallback
33+
* @see TransactionCallback#doInTransaction
3734
*/
3835
public class SimpleTransactionStatus extends AbstractTransactionStatus {
3936

4037
private final boolean newTransaction;
4138

4239

4340
/**
44-
* Create a new instance of the {@link SimpleTransactionStatus} class,
41+
* Create a new {@code SimpleTransactionStatus} instance,
4542
* indicating a new transaction.
4643
*/
4744
public SimpleTransactionStatus() {
4845
this(true);
4946
}
5047

5148
/**
52-
* Create a new instance of the {@link SimpleTransactionStatus} class.
49+
* Create a new {@code SimpleTransactionStatus} instance.
5350
* @param newTransaction whether to indicate a new transaction
5451
*/
5552
public SimpleTransactionStatus(boolean newTransaction) {

0 commit comments

Comments
 (0)