default Object[] asArray() { return asList().toArray(); }
/** * Returns <code>true</code> if the raw value is <code>null</code> */ default boolean isNull() { return null == raw(); }
/** * Parse the yaml content to {@link YamlValue}. */ public static YamlValue parse(Reader reader) throws YamlException { return YamlValue.of(decode(reader)); }
@Override public boolean readProperties(AppPropertyContext context, Resource resource) { String filename = resource.getFilename(); if(Strings.endsWithIgnoreCase(filename, ".yaml") || Strings.endsWithIgnoreCase(filename,".yml")) { String content = resource.getContent(); if(Strings.isEmpty(content)) { return true; } Map<String, Object> map = YAML.parse(content).asMap(); if(map.isEmpty()) { return true; } Map<String, String> props = Maps.toProperties(map); props.forEach((key, value) -> putProperty(context, resource, key, value)); return true; } return false; }
public YamlValue getValue(String key){ Object o = get(key); return null == o ? null : YamlValue.of(o); }
@Override protected YamlValue computeNext() { if(!it.hasNext()){ return endOfData(); } return YamlValue.of(it.next()); } };
default boolean isArray() { return raw() instanceof List; }
/** * Parse the yaml content to {@link YamlValue}. */ public static YamlValue parse(String string) throws YamlException { return YamlValue.of(decode(string)); }
default boolean isMap() { return raw() instanceof Map; }
public YamlValue getValue(int i){ Object o = get(i); return null == o ? null : YamlValue.of(o); }