Skip to content

Commit dc265c1

Browse files
ngocnhan-tran1996mp911de
authored andcommitted
Polishing.
Add missing Override annotations. Use instanceof pattern variables, use diamond operator where possible. Closes #3162
1 parent b84d603 commit dc265c1

File tree

96 files changed

+228
-62
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+228
-62
lines changed

src/main/java/org/springframework/data/aot/DefaultAotContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class DefaultAotContext implements AotContext {
3939
private final ConfigurableListableBeanFactory factory;
4040

4141
public DefaultAotContext(BeanFactory beanFactory) {
42-
factory = beanFactory instanceof ConfigurableListableBeanFactory ? (ConfigurableListableBeanFactory) beanFactory
42+
factory = beanFactory instanceof ConfigurableListableBeanFactory cbf ? cbf
4343
: new DefaultListableBeanFactory(beanFactory);
4444
}
4545

src/main/java/org/springframework/data/convert/ConfigurableTypeInformationMapper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public ConfigurableTypeInformationMapper(Map<? extends Class<?>, String> sourceT
6666
}
6767
}
6868

69+
@Override
6970
public Alias createAliasFor(TypeInformation<?> type) {
7071
return typeToAlias.getOrDefault(type, Alias.NONE);
7172
}

src/main/java/org/springframework/data/convert/MappingContextTypeInformationMapper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public MappingContextTypeInformationMapper(MappingContext<? extends PersistentEn
5858
}
5959
}
6060

61+
@Override
6162
public Alias createAliasFor(TypeInformation<?> type) {
6263

6364
return typeMap.computeIfAbsent(type.getRawTypeInformation(), key -> {

src/main/java/org/springframework/data/convert/SimplePropertyValueConverterRegistry.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ public int size() {
7979
return converterRegistrationMap.size();
8080
}
8181

82+
@Override
8283
public boolean isEmpty() {
8384
return converterRegistrationMap.isEmpty();
8485
}

src/main/java/org/springframework/data/crossstore/HashMapChangeSet.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public HashMapChangeSet() {
4141
this(new HashMap<>());
4242
}
4343

44+
@Override
4445
public void set(String key, Object o) {
4546
values.put(key, o);
4647
}
@@ -49,15 +50,18 @@ public String toString() {
4950
return "HashMapChangeSet: values=[" + values + "]";
5051
}
5152

53+
@Override
5254
public Map<String, Object> getValues() {
5355
return Collections.unmodifiableMap(values);
5456
}
5557

58+
@Override
5659
@Nullable
5760
public Object removeProperty(String k) {
5861
return this.values.remove(k);
5962
}
6063

64+
@Override
6165
@Nullable
6266
public <T> T get(String key, Class<T> requiredClass, ConversionService conversionService) {
6367

src/main/java/org/springframework/data/domain/Chunk.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,42 +54,52 @@ public Chunk(List<T> content, Pageable pageable) {
5454
this.pageable = pageable;
5555
}
5656

57+
@Override
5758
public int getNumber() {
5859
return pageable.isPaged() ? pageable.getPageNumber() : 0;
5960
}
6061

62+
@Override
6163
public int getSize() {
6264
return pageable.isPaged() ? pageable.getPageSize() : content.size();
6365
}
6466

67+
@Override
6568
public int getNumberOfElements() {
6669
return content.size();
6770
}
6871

72+
@Override
6973
public boolean hasPrevious() {
7074
return getNumber() > 0;
7175
}
7276

77+
@Override
7378
public boolean isFirst() {
7479
return !hasPrevious();
7580
}
7681

82+
@Override
7783
public boolean isLast() {
7884
return !hasNext();
7985
}
8086

87+
@Override
8188
public Pageable nextPageable() {
8289
return hasNext() ? pageable.next() : Pageable.unpaged();
8390
}
8491

92+
@Override
8593
public Pageable previousPageable() {
8694
return hasPrevious() ? pageable.previousOrFirst() : Pageable.unpaged();
8795
}
8896

97+
@Override
8998
public boolean hasContent() {
9099
return !content.isEmpty();
91100
}
92101

102+
@Override
93103
public List<T> getContent() {
94104
return Collections.unmodifiableList(content);
95105
}

src/main/java/org/springframework/data/domain/Page.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,6 @@ static <T> Page<T> empty(Pageable pageable) {
6969
* @return a new {@link Page} with the content of the current one mapped by the given {@link Function}.
7070
* @since 1.10
7171
*/
72+
@Override
7273
<U> Page<U> map(Function<? super T, ? extends U> converter);
7374
}

src/main/java/org/springframework/data/domain/PageRequest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ public static PageRequest ofSize(int pageSize) {
9797
return PageRequest.of(0, pageSize);
9898
}
9999

100+
@Override
100101
public Sort getSort() {
101102
return sort;
102103
}

src/main/java/org/springframework/data/domain/Slice.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ default Pageable getPageable() {
136136
* @return a new {@link Slice} with the content of the current one mapped by the given {@link Converter}.
137137
* @since 1.10
138138
*/
139+
@Override
139140
<U> Slice<U> map(Function<? super T, ? extends U> converter);
140141

141142
/**

src/main/java/org/springframework/data/domain/SliceImpl.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package org.springframework.data.domain;
1717

18+
import java.io.Serial;
1819
import java.util.List;
1920
import java.util.function.Function;
2021

@@ -29,6 +30,7 @@
2930
*/
3031
public class SliceImpl<T> extends Chunk<T> {
3132

33+
@Serial
3234
private static final long serialVersionUID = 867755909294344406L;
3335

3436
private final boolean hasNext;
@@ -59,6 +61,7 @@ public SliceImpl(List<T> content) {
5961
this(content, Pageable.unpaged(), false);
6062
}
6163

64+
@Override
6265
public boolean hasNext() {
6366
return hasNext;
6467
}
@@ -74,7 +77,7 @@ public String toString() {
7477
String contentType = "UNKNOWN";
7578
List<T> content = getContent();
7679

77-
if (content.size() > 0) {
80+
if (!content.isEmpty()) {
7881
contentType = content.get(0).getClass().getName();
7982
}
8083

0 commit comments

Comments
 (0)