]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - org.argeo.api.acr/src/org/argeo/api/acr/Content.java
Improve ACR search and edition
[lgpl/argeo-commons.git] / org.argeo.api.acr / src / org / argeo / api / acr / Content.java
index f52ab31b8f25223e109b4781707502f924cd5ebd..4956037c8ab268dfc38e101681337e4353bce477 100644 (file)
@@ -82,25 +82,11 @@ public interface Content extends Iterable<Content>, Map<QName, Object> {
                }
                List<A> res = getMultiple(key, type);
                return res;
-//             if (res == null)
-//                     return null;
-//             else {
-//                     if (res.isEmpty())
-//                             throw new IllegalStateException("Metadata " + key + " is not availabel as list of type " + type);
-//                     return res.get();
-//             }
        }
 
        /*
         * CONTENT OPERATIONS
         */
-//     default CompletionStage<Content> edit(Consumer<Content> work) {
-//             return CompletableFuture.supplyAsync(() -> {
-//                     work.accept(this);
-//                     return this;
-//             }).minimalCompletionStage();
-//     }
-
        Content add(QName name, QName... classes);
 
        default Content add(String name, QName... classes) {
@@ -242,6 +228,14 @@ public interface Content extends Iterable<Content>, Map<QName, Object> {
        /*
         * ATTR AS STRING
         */
+       /**
+        * Convenience method returning an attribute as a {@link String}.
+        * 
+        * @param key the attribute name
+        * @return the attribute value as a {@link String} or <code>null</code>.
+        * 
+        * @see Object#toString()
+        */
        default String attr(QName key) {
                // TODO check String type?
                Object obj = get(key);
@@ -250,21 +244,39 @@ public interface Content extends Iterable<Content>, Map<QName, Object> {
                return obj.toString();
        }
 
+       /**
+        * Convenience method returning an attribute as a {@link String}.
+        * 
+        * @param key the attribute name
+        * @return the attribute value as a {@link String} or <code>null</code>.
+        * 
+        * @see Object#toString()
+        */
        default String attr(QNamed key) {
                return attr(key.qName());
        }
 
+       /**
+        * Convenience method returning an attribute as a {@link String}.
+        * 
+        * @param key the attribute name
+        * @return the attribute value as a {@link String} or <code>null</code>.
+        * 
+        * @see Object#toString()
+        */
        default String attr(String key) {
                return attr(unqualified(key));
        }
-//
-//     default String attr(Object key) {
-//             return key != null ? attr(key.toString()) : attr(null);
-//     }
-//
-//     default <A> A get(Object key, Class<A> clss) {
-//             return key != null ? get(key.toString(), clss) : get(null, clss);
-//     }
+
+       /*
+        * CONTEXT
+        */
+       /**
+        * A content within this repository
+        * 
+        * @param path either an abolute path or a path relative to this content
+        */
+       Content getContent(String path);
 
        /*
         * EXPERIMENTAL UNSUPPORTED