X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.api%2Fsrc%2Forg%2Fargeo%2Fapi%2Fgcr%2FContent.java;h=b2fc3c9063a37f156135f5efb078e7a7eb18a850;hb=ff7bbd1653479139bbca09ceb5d80718be027a33;hp=b032aa7b888020dce1779b34d0434ee36613fd28;hpb=b067bbdda588e7e1d592417431718b761740a305;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.api/src/org/argeo/api/gcr/Content.java b/org.argeo.api/src/org/argeo/api/gcr/Content.java index b032aa7b8..b2fc3c906 100644 --- a/org.argeo.api/src/org/argeo/api/gcr/Content.java +++ b/org.argeo.api/src/org/argeo/api/gcr/Content.java @@ -11,15 +11,19 @@ public interface Content extends Iterable, Map { // Iterable keys(); - A get(String key, Class clss); + A get(String key, Class clss) throws IllegalArgumentException; // ContentSession getSession(); /* * DEFAULT METHODS */ - default A adapt(Class clss) { - return null; + default A adapt(Class clss) throws IllegalArgumentException { + throw new IllegalArgumentException("Cannot adapt content " + this + " to " + clss.getName()); + } + + default C open(Class clss) throws Exception, IllegalArgumentException { + throw new IllegalArgumentException("Cannot open content " + this + " as " + clss.getName()); } /*