* A semi-structured content, with attributes, within a hierarchical structure.
*/
public interface Content extends Iterable<Content>, Map<QName, Object> {
+ /** The base of a repository path. */
+ String ROOT_PATH = "/";
QName getName();
return res;
}
+ default List<Content> children(QNamed name) {
+ return children(name.qName());
+ }
+
+ default Optional<Content> soleChild(QNamed name) {
+ return soleChild(name.qName());
+ }
+
default Optional<Content> soleChild(QName name) {
List<Content> res = children(name);
if (res.isEmpty())
* @see Object#toString()
*/
default String attr(QName key) {
- // TODO check String type?
- Object obj = get(key);
- if (obj == null)
- return null;
- return obj.toString();
+ return get(key, String.class).orElse(null);
}
/**
/**
* A content within this repository
*
- * @param path either an abolute path or a path relative to this content
+ * @param path either an absolute path or a path relative to this content
*/
- Content getContent(String path);
+ Optional<Content> getContent(String path);
/*
* EXPERIMENTAL UNSUPPORTED