Skip to content

Commit 729b19a

Browse files
committed
Align ReactiveTypeDescriptor accessor methods
1 parent c2b8c59 commit 729b19a

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

spring-core/src/main/java/org/springframework/core/ReactiveAdapter.java

Lines changed: 7 additions & 7 deletions
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-2019 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.
@@ -84,17 +84,17 @@ public boolean isMultiValue() {
8484
}
8585

8686
/**
87-
* Shortcut for {@code getDescriptor().supportsEmpty()}.
87+
* Shortcut for {@code getDescriptor().isNoValue()}.
8888
*/
89-
public boolean supportsEmpty() {
90-
return getDescriptor().supportsEmpty();
89+
public boolean isNoValue() {
90+
return getDescriptor().isNoValue();
9191
}
9292

9393
/**
94-
* Shortcut for {@code getDescriptor().isNoValue()}.
94+
* Shortcut for {@code getDescriptor().supportsEmpty()}.
9595
*/
96-
public boolean isNoValue() {
97-
return getDescriptor().isNoValue();
96+
public boolean supportsEmpty() {
97+
return getDescriptor().supportsEmpty();
9898
}
9999

100100

spring-core/src/main/java/org/springframework/core/ReactiveTypeDescriptor.java

Lines changed: 19 additions & 19 deletions
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-2019 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,7 +23,7 @@
2323

2424
/**
2525
* Describes the semantics of a reactive type including boolean checks for
26-
* {@link #isMultiValue()}, {@link #supportsEmpty()}, and {@link #isNoValue()}.
26+
* {@link #isMultiValue()}, {@link #isNoValue()}, and {@link #supportsEmpty()}.
2727
*
2828
* @author Rossen Stoyanchev
2929
* @since 5.0
@@ -32,25 +32,25 @@ public class ReactiveTypeDescriptor {
3232

3333
private final Class<?> reactiveType;
3434

35-
@Nullable
36-
private final Supplier<?> emptyValueSupplier;
37-
3835
private final boolean multiValue;
3936

4037
private final boolean noValue;
4138

39+
@Nullable
40+
private final Supplier<?> emptyValueSupplier;
41+
4242

4343
/**
4444
* Private constructor. See static factory methods.
4545
*/
46-
private ReactiveTypeDescriptor(Class<?> reactiveType, @Nullable Supplier<?> emptySupplier,
47-
boolean multiValue, boolean noValue) {
46+
private ReactiveTypeDescriptor(Class<?> reactiveType, boolean multiValue, boolean noValue,
47+
@Nullable Supplier<?> emptySupplier) {
4848

4949
Assert.notNull(reactiveType, "'reactiveType' must not be null");
5050
this.reactiveType = reactiveType;
51-
this.emptyValueSupplier = emptySupplier;
5251
this.multiValue = multiValue;
5352
this.noValue = noValue;
53+
this.emptyValueSupplier = emptySupplier;
5454
}
5555

5656

@@ -71,13 +71,6 @@ public boolean isMultiValue() {
7171
return this.multiValue;
7272
}
7373

74-
/**
75-
* Return {@code true} if the reactive type can complete with no values.
76-
*/
77-
public boolean supportsEmpty() {
78-
return (this.emptyValueSupplier != null);
79-
}
80-
8174
/**
8275
* Return {@code true} if the reactive type does not produce any values and
8376
* only provides completion and error signals.
@@ -86,6 +79,13 @@ public boolean isNoValue() {
8679
return this.noValue;
8780
}
8881

82+
/**
83+
* Return {@code true} if the reactive type can complete with no values.
84+
*/
85+
public boolean supportsEmpty() {
86+
return (this.emptyValueSupplier != null);
87+
}
88+
8989
/**
9090
* Return an empty-value instance for the underlying reactive or async type.
9191
* Use of this type implies {@link #supportsEmpty()} is true.
@@ -119,7 +119,7 @@ public int hashCode() {
119119
* @param emptySupplier a supplier of an empty-value instance of the reactive type
120120
*/
121121
public static ReactiveTypeDescriptor multiValue(Class<?> type, Supplier<?> emptySupplier) {
122-
return new ReactiveTypeDescriptor(type, emptySupplier, true, false);
122+
return new ReactiveTypeDescriptor(type, true, false, emptySupplier);
123123
}
124124

125125
/**
@@ -128,15 +128,15 @@ public static ReactiveTypeDescriptor multiValue(Class<?> type, Supplier<?> empty
128128
* @param emptySupplier a supplier of an empty-value instance of the reactive type
129129
*/
130130
public static ReactiveTypeDescriptor singleOptionalValue(Class<?> type, Supplier<?> emptySupplier) {
131-
return new ReactiveTypeDescriptor(type, emptySupplier, false, false);
131+
return new ReactiveTypeDescriptor(type, false, false, emptySupplier);
132132
}
133133

134134
/**
135135
* Descriptor for a reactive type that must produce 1 value to complete.
136136
* @param type the reactive type
137137
*/
138138
public static ReactiveTypeDescriptor singleRequiredValue(Class<?> type) {
139-
return new ReactiveTypeDescriptor(type, null, false, false);
139+
return new ReactiveTypeDescriptor(type, false, false, null);
140140
}
141141

142142
/**
@@ -145,7 +145,7 @@ public static ReactiveTypeDescriptor singleRequiredValue(Class<?> type) {
145145
* @param emptySupplier a supplier of an empty-value instance of the reactive type
146146
*/
147147
public static ReactiveTypeDescriptor noValue(Class<?> type, Supplier<?> emptySupplier) {
148-
return new ReactiveTypeDescriptor(type, emptySupplier, false, true);
148+
return new ReactiveTypeDescriptor(type, false, true, emptySupplier);
149149
}
150150

151151
}

0 commit comments

Comments
 (0)