Modernize code for diamond, isEmpty & pattern matching

This commit is contained in:
Tran Ngoc Nhan
2024-09-24 01:42:38 +07:00
committed by GitHub
parent 40faaa0c15
commit fc377126de
107 changed files with 550 additions and 454 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2023 the original author or authors.
* Copyright 2015-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,6 +42,7 @@ import org.springframework.messaging.MessagingException;
* @author Gunnar Hillert
* @author Artem Bilan
* @author Ingo Dueppe
* @author Ngoc Nhan
*
* @since 6.1
*/
@@ -86,11 +87,11 @@ public class UnZipTransformer extends AbstractZipTransformer {
inputStream = new FileInputStream(filePayload);
}
else if (payload instanceof InputStream) {
inputStream = (InputStream) payload;
else if (payload instanceof InputStream castInputStream) {
inputStream = castInputStream;
}
else if (payload instanceof byte[]) {
inputStream = new ByteArrayInputStream((byte[]) payload);
else if (payload instanceof byte[] bytes) {
inputStream = new ByteArrayInputStream(bytes);
}
else {
throw new IllegalArgumentException("Unsupported payload type '" + payload.getClass().getSimpleName()