Skip to content

Commit 74608e6

Browse files
committed
Polishing
1 parent 831f09c commit 74608e6

File tree

12 files changed

+43
-65
lines changed

12 files changed

+43
-65
lines changed

spring-core/src/test/java/org/springframework/core/annotation/AnnotatedElementUtilsTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,8 +594,7 @@ public void findAndSynthesizeAnnotationAttributesOnClassWithAttributeAliasesInTa
594594

595595
@Test
596596
public void findMergedAnnotationAttributesOnClassWithAttributeAliasInComposedAnnotationAndNestedAnnotationsInTargetAnnotation() {
597-
AnnotationAttributes attributes = assertComponentScanAttributes(TestComponentScanClass.class,
598-
"com.example.app.test");
597+
AnnotationAttributes attributes = assertComponentScanAttributes(TestComponentScanClass.class, "com.example.app.test");
599598

600599
Filter[] excludeFilters = attributes.getAnnotationArray("excludeFilters", Filter.class);
601600
assertNotNull(excludeFilters);

spring-core/src/test/java/org/springframework/core/annotation/AnnotationAttributesTests.java

Lines changed: 23 additions & 17 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-2016 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.
@@ -54,23 +54,23 @@ public void typeSafeAttributeAccess() {
5454
nestedAttributes.put("name", "algernon");
5555

5656
attributes.put("name", "dave");
57-
attributes.put("names", new String[] { "dave", "frank", "hal" });
57+
attributes.put("names", new String[] {"dave", "frank", "hal"});
5858
attributes.put("bool1", true);
5959
attributes.put("bool2", false);
6060
attributes.put("color", Color.RED);
6161
attributes.put("class", Integer.class);
62-
attributes.put("classes", new Class<?>[] { Number.class, Short.class, Integer.class });
62+
attributes.put("classes", new Class<?>[] {Number.class, Short.class, Integer.class});
6363
attributes.put("number", 42);
6464
attributes.put("anno", nestedAttributes);
65-
attributes.put("annoArray", new AnnotationAttributes[] { nestedAttributes });
65+
attributes.put("annoArray", new AnnotationAttributes[] {nestedAttributes});
6666

6767
assertThat(attributes.getString("name"), equalTo("dave"));
68-
assertThat(attributes.getStringArray("names"), equalTo(new String[] { "dave", "frank", "hal" }));
68+
assertThat(attributes.getStringArray("names"), equalTo(new String[] {"dave", "frank", "hal"}));
6969
assertThat(attributes.getBoolean("bool1"), equalTo(true));
7070
assertThat(attributes.getBoolean("bool2"), equalTo(false));
7171
assertThat(attributes.<Color>getEnum("color"), equalTo(Color.RED));
7272
assertTrue(attributes.getClass("class").equals(Integer.class));
73-
assertThat(attributes.getClassArray("classes"), equalTo(new Class[] { Number.class, Short.class, Integer.class }));
73+
assertThat(attributes.getClassArray("classes"), equalTo(new Class<?>[] {Number.class, Short.class, Integer.class}));
7474
assertThat(attributes.<Integer>getNumber("number"), equalTo(42));
7575
assertThat(attributes.getAnnotation("anno").<Integer>getNumber("value"), equalTo(10));
7676
assertThat(attributes.getAnnotationArray("annoArray")[0].getString("name"), equalTo("algernon"));
@@ -99,8 +99,8 @@ public void singleElementToSingleElementArrayConversionSupport() throws Exceptio
9999
attributes.put("filters", filter);
100100

101101
// Get back arrays of single elements
102-
assertThat(attributes.getStringArray("names"), equalTo(new String[] { "Dogbert" }));
103-
assertThat(attributes.getClassArray("classes"), equalTo(new Class[] { Number.class }));
102+
assertThat(attributes.getStringArray("names"), equalTo(new String[] {"Dogbert"}));
103+
assertThat(attributes.getClassArray("classes"), equalTo(new Class<?>[] {Number.class}));
104104

105105
AnnotationAttributes[] array = attributes.getAnnotationArray("nestedAttributes");
106106
assertNotNull(array);
@@ -118,7 +118,7 @@ public void nestedAnnotations() throws Exception {
118118
Filter filter = FilteredClass.class.getAnnotation(Filter.class);
119119

120120
attributes.put("filter", filter);
121-
attributes.put("filters", new Filter[] { filter, filter });
121+
attributes.put("filters", new Filter[] {filter, filter});
122122

123123
Filter retrievedFilter = attributes.getAnnotation("filter", Filter.class);
124124
assertThat(retrievedFilter, equalTo(filter));
@@ -257,7 +257,7 @@ private String getAliasedStringWithImplicitAliases(String attributeName) {
257257

258258
@Test
259259
public void getAliasedStringArray() {
260-
final String[] INPUT = new String[] { "test.xml" };
260+
final String[] INPUT = new String[] {"test.xml"};
261261
final String[] EMPTY = new String[0];
262262

263263
attributes.clear();
@@ -297,7 +297,7 @@ public void getAliasedStringArray() {
297297

298298
@Test
299299
public void getAliasedStringArrayWithImplicitAliases() {
300-
final String[] INPUT = new String[] { "test.xml" };
300+
final String[] INPUT = new String[] {"test.xml"};
301301
final String[] EMPTY = new String[0];
302302
final List<String> aliases = Arrays.asList("value", "location1", "location2", "location3", "xmlFile", "groovyScript");
303303

@@ -352,8 +352,8 @@ public void getAliasedStringArrayWithMissingAliasedAttributes() {
352352

353353
@Test
354354
public void getAliasedStringArrayWithDifferentAliasedValues() {
355-
attributes.put("location", new String[] { "1.xml" });
356-
attributes.put("value", new String[] { "2.xml" });
355+
attributes.put("location", new String[] {"1.xml"});
356+
attributes.put("value", new String[] {"2.xml"});
357357

358358
exception.expect(AnnotationConfigurationException.class);
359359
exception.expectMessage(containsString("In annotation [" + ContextConfig.class.getName() + "]"));
@@ -382,7 +382,7 @@ private String[] getAliasedStringArrayWithImplicitAliases(String attributeName)
382382

383383
@Test
384384
public void getAliasedClassArray() {
385-
final Class<?>[] INPUT = new Class<?>[] { String.class };
385+
final Class<?>[] INPUT = new Class<?>[] {String.class};
386386
final Class<?>[] EMPTY = new Class<?>[0];
387387

388388
attributes.clear();
@@ -422,7 +422,7 @@ public void getAliasedClassArray() {
422422

423423
@Test
424424
public void getAliasedClassArrayWithImplicitAliases() {
425-
final Class<?>[] INPUT = new Class<?>[] { String.class };
425+
final Class<?>[] INPUT = new Class<?>[] {String.class};
426426
final Class<?>[] EMPTY = new Class<?>[0];
427427
final List<String> aliases = Arrays.asList("value", "location1", "location2", "location3", "xmlFile", "groovyScript");
428428

@@ -465,8 +465,8 @@ public void getAliasedClassArrayWithMissingAliasedAttributes() {
465465

466466
@Test
467467
public void getAliasedClassArrayWithDifferentAliasedValues() {
468-
attributes.put("classes", new Class[] { String.class });
469-
attributes.put("value", new Class[] { Number.class });
468+
attributes.put("classes", new Class<?>[] {String.class});
469+
attributes.put("value", new Class<?>[] {Number.class});
470470

471471
exception.expect(AnnotationConfigurationException.class);
472472
exception.expectMessage(containsString("In annotation [" + Filter.class.getName() + "]"));
@@ -477,6 +477,7 @@ public void getAliasedClassArrayWithDifferentAliasedValues() {
477477
getAliasedClassArray("classes");
478478
}
479479

480+
480481
private Class<?>[] getAliasedClassArray(String attributeName) {
481482
return attributes.getAliasedClassArray(attributeName, Filter.class, null);
482483
}
@@ -491,9 +492,11 @@ private Class<?>[] getAliasedClassArrayWithImplicitAliases(String attributeName)
491492

492493

493494
enum Color {
495+
494496
RED, WHITE, BLUE
495497
}
496498

499+
497500
@Retention(RetentionPolicy.RUNTIME)
498501
@interface Filter {
499502

@@ -506,10 +509,12 @@ enum Color {
506509
String pattern();
507510
}
508511

512+
509513
@Filter(pattern = "foo")
510514
static class FilteredClass {
511515
}
512516

517+
513518
/**
514519
* Mock of {@code org.springframework.context.annotation.Scope}.
515520
*/
@@ -523,6 +528,7 @@ static class FilteredClass {
523528
String name() default "singleton";
524529
}
525530

531+
526532
@Scope(name = "custom")
527533
static class ScopedComponent {
528534
}

spring-jdbc/src/main/java/org/springframework/jdbc/core/ConnectionCallback.java

Lines changed: 1 addition & 4 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-2016 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.
@@ -43,19 +43,16 @@ public interface ConnectionCallback<T> {
4343
* Gets called by {@code JdbcTemplate.execute} with an active JDBC
4444
* Connection. Does not need to care about activating or closing the
4545
* Connection, or handling transactions.
46-
*
4746
* <p>If called without a thread-bound JDBC transaction (initiated by
4847
* DataSourceTransactionManager), the code will simply get executed on the
4948
* JDBC connection with its transactional semantics. If JdbcTemplate is
5049
* configured to use a JTA-aware DataSource, the JDBC Connection and thus
5150
* the callback code will be transactional if a JTA transaction is active.
52-
*
5351
* <p>Allows for returning a result object created within the callback, i.e.
5452
* a domain object or a collection of domain objects. Note that there's special
5553
* support for single step actions: see {@code JdbcTemplate.queryForObject}
5654
* etc. A thrown RuntimeException is treated as application exception:
5755
* it gets propagated to the caller of the template.
58-
*
5956
* @param con active JDBC Connection
6057
* @return a result object, or {@code null} if none
6158
* @throws SQLException if thrown by a JDBC method, to be auto-converted

spring-jdbc/src/main/java/org/springframework/jdbc/core/PreparedStatementCallback.java

Lines changed: 1 addition & 5 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-2016 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.
@@ -47,26 +47,22 @@ public interface PreparedStatementCallback<T> {
4747
* PreparedStatement. Does not need to care about closing the Statement
4848
* or the Connection, or about handling transactions: this will all be
4949
* handled by Spring's JdbcTemplate.
50-
*
5150
* <p><b>NOTE:</b> Any ResultSets opened should be closed in finally blocks
5251
* within the callback implementation. Spring will close the Statement
5352
* object after the callback returned, but this does not necessarily imply
5453
* that the ResultSet resources will be closed: the Statement objects might
5554
* get pooled by the connection pool, with {@code close} calls only
5655
* returning the object to the pool but not physically closing the resources.
57-
*
5856
* <p>If called without a thread-bound JDBC transaction (initiated by
5957
* DataSourceTransactionManager), the code will simply get executed on the
6058
* JDBC connection with its transactional semantics. If JdbcTemplate is
6159
* configured to use a JTA-aware DataSource, the JDBC connection and thus
6260
* the callback code will be transactional if a JTA transaction is active.
63-
*
6461
* <p>Allows for returning a result object created within the callback, i.e.
6562
* a domain object or a collection of domain objects. Note that there's
6663
* special support for single step actions: see JdbcTemplate.queryForObject etc.
6764
* A thrown RuntimeException is treated as application exception, it gets
6865
* propagated to the caller of the template.
69-
*
7066
* @param ps active JDBC PreparedStatement
7167
* @return a result object, or {@code null} if none
7268
* @throws SQLException if thrown by a JDBC method, to be auto-converted

spring-jdbc/src/main/java/org/springframework/jdbc/core/StatementCallback.java

Lines changed: 1 addition & 5 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-2016 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.
@@ -40,26 +40,22 @@ public interface StatementCallback<T> {
4040
* Statement. Does not need to care about closing the Statement or the
4141
* Connection, or about handling transactions: this will all be handled
4242
* by Spring's JdbcTemplate.
43-
*
4443
* <p><b>NOTE:</b> Any ResultSets opened should be closed in finally blocks
4544
* within the callback implementation. Spring will close the Statement
4645
* object after the callback returned, but this does not necessarily imply
4746
* that the ResultSet resources will be closed: the Statement objects might
4847
* get pooled by the connection pool, with {@code close} calls only
4948
* returning the object to the pool but not physically closing the resources.
50-
*
5149
* <p>If called without a thread-bound JDBC transaction (initiated by
5250
* DataSourceTransactionManager), the code will simply get executed on the
5351
* JDBC connection with its transactional semantics. If JdbcTemplate is
5452
* configured to use a JTA-aware DataSource, the JDBC connection and thus
5553
* the callback code will be transactional if a JTA transaction is active.
56-
*
5754
* <p>Allows for returning a result object created within the callback, i.e.
5855
* a domain object or a collection of domain objects. Note that there's
5956
* special support for single step actions: see JdbcTemplate.queryForObject etc.
6057
* A thrown RuntimeException is treated as application exception, it gets
6158
* propagated to the caller of the template.
62-
*
6359
* @param stmt active JDBC Statement
6460
* @return a result object, or {@code null} if none
6561
* @throws SQLException if thrown by a JDBC method, to be auto-converted

spring-jdbc/src/main/java/org/springframework/jdbc/support/lob/OracleLobHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2016 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.
@@ -613,7 +613,7 @@ public void close() {
613613
/**
614614
* Internal callback interface for use with createLob.
615615
*/
616-
protected static interface LobCallback {
616+
protected interface LobCallback {
617617

618618
/**
619619
* Populate the given BLOB or CLOB instance with content.

spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/HibernateCallback.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2016 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.
@@ -36,12 +36,10 @@ public interface HibernateCallback<T> {
3636
* Gets called by {@code HibernateTemplate.execute} with an active
3737
* Hibernate {@code Session}. Does not need to care about activating
3838
* or closing the {@code Session}, or handling transactions.
39-
*
4039
* <p>Allows for returning a result object created within the callback,
4140
* i.e. a domain object or a collection of domain objects.
4241
* A thrown custom RuntimeException is treated as an application exception:
4342
* It gets propagated to the caller of the template.
44-
*
4543
* @param session active Hibernate session
4644
* @return a result object, or {@code null} if none
4745
* @throws HibernateException if thrown by the Hibernate API

spring-orm-hibernate5/src/main/java/org/springframework/orm/hibernate5/HibernateCallback.java

Lines changed: 1 addition & 3 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-2016 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.
@@ -36,12 +36,10 @@ public interface HibernateCallback<T> {
3636
* Gets called by {@code HibernateTemplate.execute} with an active
3737
* Hibernate {@code Session}. Does not need to care about activating
3838
* or closing the {@code Session}, or handling transactions.
39-
*
4039
* <p>Allows for returning a result object created within the callback,
4140
* i.e. a domain object or a collection of domain objects.
4241
* A thrown custom RuntimeException is treated as an application exception:
4342
* It gets propagated to the caller of the template.
44-
*
4543
* @param session active Hibernate session
4644
* @return a result object, or {@code null} if none
4745
* @throws HibernateException if thrown by the Hibernate API

spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateCallback.java

Lines changed: 1 addition & 4 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-2016 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.
@@ -49,18 +49,15 @@ public interface HibernateCallback<T> {
4949
* Gets called by {@code HibernateTemplate.execute} with an active
5050
* Hibernate {@code Session}. Does not need to care about activating
5151
* or closing the {@code Session}, or handling transactions.
52-
*
5352
* <p>If called without a thread-bound Hibernate transaction (initiated
5453
* by HibernateTransactionManager), the code will simply get executed on the
5554
* underlying JDBC connection with its transactional semantics. If Hibernate
5655
* is configured to use a JTA-aware DataSource, the JDBC connection and thus
5756
* the callback code will be transactional if a JTA transaction is active.
58-
*
5957
* <p>Allows for returning a result object created within the callback,
6058
* i.e. a domain object or a collection of domain objects.
6159
* A thrown custom RuntimeException is treated as an application exception:
6260
* It gets propagated to the caller of the template.
63-
*
6461
* @param session active Hibernate session
6562
* @return a result object, or {@code null} if none
6663
* @throws HibernateException if thrown by the Hibernate API

spring-tx/src/main/java/org/springframework/jca/cci/core/ConnectionCallback.java

Lines changed: 1 addition & 4 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-2016 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.
@@ -46,19 +46,16 @@ public interface ConnectionCallback<T> {
4646
* Gets called by {@code CciTemplate.execute} with an active CCI Connection.
4747
* Does not need to care about activating or closing the Connection, or handling
4848
* transactions.
49-
*
5049
* <p>If called without a thread-bound CCI transaction (initiated by
5150
* CciLocalTransactionManager), the code will simply get executed on the CCI
5251
* Connection with its transactional semantics. If CciTemplate is configured
5352
* to use a JTA-aware ConnectionFactory, the CCI Connection and thus the callback
5453
* code will be transactional if a JTA transaction is active.
55-
*
5654
* <p>Allows for returning a result object created within the callback, i.e.
5755
* a domain object or a collection of domain objects. Note that there's special
5856
* support for single step actions: see the {@code CciTemplate.execute}
5957
* variants. A thrown RuntimeException is treated as application exception:
6058
* it gets propagated to the caller of the template.
61-
*
6259
* @param connection active CCI Connection
6360
* @param connectionFactory the CCI ConnectionFactory that the Connection was
6461
* created with (gives access to RecordFactory and ResourceAdapterMetaData)

spring-tx/src/main/java/org/springframework/jca/cci/core/InteractionCallback.java

Lines changed: 1 addition & 4 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-2016 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.
@@ -47,19 +47,16 @@ public interface InteractionCallback<T> {
4747
* Gets called by {@code CciTemplate.execute} with an active CCI Interaction.
4848
* Does not need to care about activating or closing the Interaction, or
4949
* handling transactions.
50-
*
5150
* <p>If called without a thread-bound CCI transaction (initiated by
5251
* CciLocalTransactionManager), the code will simply get executed on the CCI
5352
* Interaction with its transactional semantics. If CciTemplate is configured
5453
* to use a JTA-aware ConnectionFactory, the CCI Interaction and thus the callback
5554
* code will be transactional if a JTA transaction is active.
56-
*
5755
* <p>Allows for returning a result object created within the callback, i.e.
5856
* a domain object or a collection of domain objects. Note that there's special
5957
* support for single step actions: see the {@code CciTemplate.execute}
6058
* variants. A thrown RuntimeException is treated as application exception:
6159
* it gets propagated to the caller of the template.
62-
*
6360
* @param interaction active CCI Interaction
6461
* @param connectionFactory the CCI ConnectionFactory that the Connection was
6562
* created with (gives access to RecordFactory and ResourceAdapterMetaData)

0 commit comments

Comments
 (0)