refactoring

pull/4428/head
Nikita Koksharov 3 years ago
parent f529e74f45
commit 42dd3c4e83

@ -31,7 +31,10 @@ import javax.inject.Singleton;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Optional;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
/**
*
@ -60,7 +63,8 @@ public class RedissonClientProducer {
configStream.read(array);
config = new String(array, StandardCharsets.UTF_8);
} else {
String yaml = PropertiesConvertor.toYaml("quarkus.redisson.", ConfigProvider.getConfig().getPropertyNames(), prop -> {
Stream<String> s = StreamSupport.stream(ConfigProvider.getConfig().getPropertyNames().spliterator(), false);
String yaml = PropertiesConvertor.toYaml("quarkus.redisson.", s.sorted().collect(Collectors.toList()), prop -> {
return ConfigProvider.getConfig().getValue(prop, String.class);
}, false);
config = yaml;

@ -32,6 +32,9 @@ import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
/**
*
@ -60,7 +63,8 @@ public class RedissonClientProducer {
configStream.read(array);
config = new String(array, StandardCharsets.UTF_8);
} else {
String yaml = PropertiesConvertor.toYaml("quarkus.redisson.", ConfigProvider.getConfig().getPropertyNames(), prop -> {
Stream<String> s = StreamSupport.stream(ConfigProvider.getConfig().getPropertyNames().spliterator(), false);
String yaml = PropertiesConvertor.toYaml("quarkus.redisson.", s.sorted().collect(Collectors.toList()), prop -> {
return ConfigProvider.getConfig().getValue(prop, String.class);
}, false);
config = yaml;

@ -28,11 +28,7 @@ public class PropertiesConvertor {
public static String toYaml(String suffix, Iterable<String> propertyNames, Function<String, String> resolver, boolean caseSensitive) {
Map<String, Object> map = new HashMap<>();
List<String> names = new ArrayList<>();
propertyNames.iterator().forEachRemaining(names::add);
names.sort(Comparator.naturalOrder());
for (String propertyName : names) {
for (String propertyName : propertyNames) {
if (!propertyName.startsWith(suffix)) {
continue;
}

Loading…
Cancel
Save