]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - org.argeo.api.acr/src/org/argeo/api/acr/Content.java
Improve documentation
[lgpl/argeo-commons.git] / org.argeo.api.acr / src / org / argeo / api / acr / Content.java
index b605fa1e0062140b18fd5b1784fe8ea0fd6171bc..d48f583fd7c84e4fc33c5f97f8493664c609f3b6 100644 (file)
@@ -128,6 +128,14 @@ public interface Content extends Iterable<Content>, Map<QName, Object> {
                return true;
        }
 
+       /** AND */
+       default boolean isContentClass(QNamed... contentClass) {
+               List<QName> lst = new ArrayList<>();
+               for (QNamed qNamed : contentClass)
+                       lst.add(qNamed.qName());
+               return isContentClass(lst.toArray(new QName[lst.size()]));
+       }
+
        /** OR */
        default boolean hasContentClass(QName... contentClass) {
                List<QName> contentClasses = getContentClasses();
@@ -138,8 +146,12 @@ public interface Content extends Iterable<Content>, Map<QName, Object> {
                return false;
        }
 
-       default boolean hasContentClass(QNamed contentClass) {
-               return hasContentClass(contentClass.qName());
+       /** OR */
+       default boolean hasContentClass(QNamed... contentClass) {
+               List<QName> lst = new ArrayList<>();
+               for (QNamed qNamed : contentClass)
+                       lst.add(qNamed.qName());
+               return hasContentClass(lst.toArray(new QName[lst.size()]));
        }
 
        /*
@@ -230,6 +242,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);
@@ -238,21 +258,29 @@ 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);
-//     }
 
        /*
         * EXPERIMENTAL UNSUPPORTED