YamlReader
This commit is contained in:
@@ -42,7 +42,7 @@ module org.redkale {
|
||||
exports org.redkale.util;
|
||||
exports org.redkale.watch;
|
||||
|
||||
uses org.redkale.util.YmlProvider;
|
||||
uses org.redkale.util.YamlProvider;
|
||||
uses org.redkale.props.spi.PropertiesAgentProvider;
|
||||
uses org.redkale.cached.spi.CachedManagerProvider;
|
||||
uses org.redkale.cluster.spi.ClusterAgentProvider;
|
||||
|
||||
@@ -229,7 +229,7 @@ public abstract class AnyValue {
|
||||
* @return AnyValue
|
||||
*/
|
||||
public static AnyValue loadFromYml(String text) {
|
||||
return new YmlReader(text).read();
|
||||
return new YamlReader(text).read();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1179,12 +1179,12 @@ public abstract class AnyValue {
|
||||
String key = prefix;
|
||||
int index = keyPrefixs.get(key);
|
||||
if (index == -1) {
|
||||
key = parent + k + "[" + (++index) + "]";
|
||||
key = prefix + "[" + (++index) + "]";
|
||||
props.put(key, props.remove(prefix));
|
||||
}
|
||||
key = parent + k + "[" + (++index) + "]";
|
||||
key = prefix + "[" + (++index) + "]";
|
||||
while (props.containsKey(key)) {
|
||||
key = parent + k + "[" + (++index) + "]";
|
||||
key = prefix + "[" + (++index) + "]";
|
||||
}
|
||||
props.put(key, v);
|
||||
keyPrefixs.put(prefix, index);
|
||||
|
||||
@@ -12,7 +12,7 @@ package org.redkale.util;
|
||||
* @since 2.8.0
|
||||
* @author zhangjx
|
||||
*/
|
||||
public interface YmlProvider {
|
||||
public interface YamlProvider {
|
||||
|
||||
/**
|
||||
* 将yml内容转换成AnyValue
|
||||
@@ -20,13 +20,13 @@ import org.redkale.annotation.Nonnull;
|
||||
* @since 2.8.0
|
||||
* @author zhangjx
|
||||
*/
|
||||
public class YmlReader {
|
||||
public class YamlReader {
|
||||
|
||||
private static YmlProvider currentProvider;
|
||||
private static YamlProvider currentProvider;
|
||||
|
||||
private final String text;
|
||||
|
||||
public YmlReader(String text) {
|
||||
public YamlReader(String text) {
|
||||
this.text = Objects.requireNonNull(text);
|
||||
}
|
||||
|
||||
@@ -37,22 +37,22 @@ public class YmlReader {
|
||||
/**
|
||||
* 加载解析器的实现对象
|
||||
*
|
||||
* @return YmlProvider
|
||||
* @return YamlProvider
|
||||
*/
|
||||
private static @Nonnull YmlProvider loadProvider() {
|
||||
protected static @Nonnull YamlProvider loadProvider() {
|
||||
if (currentProvider == null) {
|
||||
Iterator<YmlProvider> it = ServiceLoader.load(YmlProvider.class).iterator();
|
||||
RedkaleClassLoader.putServiceLoader(YmlProvider.class);
|
||||
List<YmlProvider> providers = new ArrayList<>();
|
||||
Iterator<YamlProvider> it = ServiceLoader.load(YamlProvider.class).iterator();
|
||||
RedkaleClassLoader.putServiceLoader(YamlProvider.class);
|
||||
List<YamlProvider> providers = new ArrayList<>();
|
||||
while (it.hasNext()) {
|
||||
YmlProvider provider = it.next();
|
||||
YamlProvider provider = it.next();
|
||||
if (provider != null) {
|
||||
RedkaleClassLoader.putReflectionPublicConstructors(
|
||||
provider.getClass(), provider.getClass().getName());
|
||||
providers.add(provider);
|
||||
}
|
||||
}
|
||||
for (YmlProvider provider : Utility.sortPriority(providers)) {
|
||||
for (YamlProvider provider : Utility.sortPriority(providers)) {
|
||||
currentProvider = provider;
|
||||
return provider;
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public class YmlReader {
|
||||
return currentProvider;
|
||||
}
|
||||
|
||||
protected static class DefaultYmlProvider implements YmlProvider {
|
||||
protected static class DefaultYmlProvider implements YamlProvider {
|
||||
|
||||
@Override
|
||||
public AnyValue read(String content) {
|
||||
Reference in New Issue
Block a user