package org.argeo.api.acr;
+import java.io.Closeable;
+import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.concurrent.CompletableFuture;
import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
<A> Optional<List<A>> getMultiple(QName key, Class<A> clss);
+ @SuppressWarnings("unchecked")
default <A> List<A> getMultiple(QName key) {
Class<A> type;
try {
/*
* 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) {
void remove();
+ /*
+ * TYPING
+ */
+ List<QName> getTypes();
+
/*
* DEFAULT METHODS
*/
- default <A> A adapt(Class<A> clss) throws IllegalArgumentException {
- throw new IllegalArgumentException("Cannot adapt content " + this + " to " + clss.getName());
+ default <A> A adapt(Class<A> clss) {
+ throw new UnsupportedOperationException("Cannot adapt content " + this + " to " + clss.getName());
+ }
+
+ default <C extends Closeable> C open(Class<C> clss) throws IOException {
+ throw new UnsupportedOperationException("Cannot open content " + this + " as " + clss.getName());
}
- default <C extends AutoCloseable> C open(Class<C> clss) throws Exception, IllegalArgumentException {
- throw new IllegalArgumentException("Cannot open content " + this + " as " + clss.getName());
+ default <A> CompletableFuture<A> write(Class<A> clss) {
+ throw new UnsupportedOperationException("Cannot write content " + this + " as " + clss.getName());
}
/*