YmlProvider
This commit is contained in:
@@ -1164,4 +1164,8 @@ public abstract class AnyValue {
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public Properties toProperties() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,12 +14,9 @@ package org.redkale.util;
|
||||
*/
|
||||
public interface YmlProvider {
|
||||
|
||||
public static final YmlProvider NIL = c -> {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
};
|
||||
|
||||
/**
|
||||
* 将yml内容转换成AnyValue
|
||||
*
|
||||
* @param content yml内容
|
||||
* @return AnyValue
|
||||
*/
|
||||
|
||||
@@ -31,11 +31,7 @@ public class YmlReader {
|
||||
}
|
||||
|
||||
public AnyValue read() {
|
||||
YmlProvider provider = loadProvider();
|
||||
if (provider == YmlProvider.NIL) {
|
||||
throw new UnsupportedOperationException("Not supported yml.");
|
||||
}
|
||||
return provider.read(text);
|
||||
return loadProvider().read(text);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,8 +56,16 @@ public class YmlReader {
|
||||
currentProvider = provider;
|
||||
return provider;
|
||||
}
|
||||
currentProvider = YmlProvider.NIL;
|
||||
currentProvider = new DefaultYmlProvider();
|
||||
}
|
||||
return currentProvider;
|
||||
}
|
||||
|
||||
protected static class DefaultYmlProvider implements YmlProvider {
|
||||
|
||||
@Override
|
||||
public AnyValue read(String content) {
|
||||
throw new UnsupportedOperationException("Not supported yml.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user