MetadataEncoder.java (spring-framework-5.3.23) | : | MetadataEncoder.java (spring-framework-5.3.24) | ||
---|---|---|---|---|
/* | /* | |||
* Copyright 2002-2020 the original author or authors. | * Copyright 2002-2022 the original author or authors. | |||
* | * | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | |||
* You may obtain a copy of the License at | * You may obtain a copy of the License at | |||
* | * | |||
* https://www.apache.org/licenses/LICENSE-2.0 | * https://www.apache.org/licenses/LICENSE-2.0 | |||
* | * | |||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, | * distributed under the License is distributed on an "AS IS" BASIS, | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
skipping to change at line 140 | skipping to change at line 140 | |||
else if (mimeType == null) { | else if (mimeType == null) { | |||
mimeType = this.metadataMimeType; | mimeType = this.metadataMimeType; | |||
} | } | |||
else if (!this.metadataMimeType.equals(mimeType)) { | else if (!this.metadataMimeType.equals(mimeType)) { | |||
throw new IllegalArgumentException( | throw new IllegalArgumentException( | |||
"Mime type is optional when not using com posite metadata, but it was provided " + | "Mime type is optional when not using com posite metadata, but it was provided " + | |||
"and does not match the c onnection metadata mime type '" + this.metadataMimeType + "'."); | "and does not match the c onnection metadata mime type '" + this.metadataMimeType + "'."); | |||
} | } | |||
ReactiveAdapter adapter = this.strategies.reactiveAdapterRegistry ().getAdapter(metadata.getClass()); | ReactiveAdapter adapter = this.strategies.reactiveAdapterRegistry ().getAdapter(metadata.getClass()); | |||
if (adapter != null) { | if (adapter != null) { | |||
Assert.isTrue(!adapter.isMultiValue(), "Expected single v | Object originalMetadata = metadata; | |||
alue: " + metadata); | Assert.isTrue(!adapter.isMultiValue(), () -> "Expected si | |||
ngle value: " + originalMetadata); | ||||
metadata = Mono.from(adapter.toPublisher(metadata)).defau ltIfEmpty(NO_VALUE); | metadata = Mono.from(adapter.toPublisher(metadata)).defau ltIfEmpty(NO_VALUE); | |||
this.hasAsyncValues = true; | this.hasAsyncValues = true; | |||
} | } | |||
this.metadataEntries.add(new MetadataEntry(metadata, mimeType)); | this.metadataEntries.add(new MetadataEntry(metadata, mimeType)); | |||
assertMetadataEntryCount(); | assertMetadataEntryCount(); | |||
return this; | return this; | |||
} | } | |||
/** | /** | |||
* Add route and/or metadata, both optional. | * Add route and/or metadata, both optional. | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 4 lines changed or added |